Comparing version 1.0.5 to 1.1.0
@@ -1,1 +0,1 @@ | ||
"use strict";function GHover(t){if(Array.isArray(t))for(var r=0;r<t.length;r++)startHover(t[r]);else startHover(t)}function getPrefix(t){for(var r=0;r<t.length;r++)if("undefined"!=typeof document.body.style[t[r]])return t[r];return null}function startHover(t){var r={x:0,y:0,z:0},e="all 0.2s ease",n=document.querySelector(t.selector);n.style.perspective="1000px",n.style[transformProperty]="rotateZ(0deg) translateZ(0)",n.addEventListener("mouseleave",function(r){return o(r.currentTarget,t)}),n.addEventListener("mousemove",function(n){for(var o=n.currentTarget,l=t.children,y={x:n.pageX-o.offsetLeft,y:n.pageY-o.offsetTop},c=0;c<l.length;c++){var h=l[c].rotate?l[c].rotate:r,u=l[c].translate?l[c].translate:r;u=a(u),h=a(h);var x={translate:{x:(u.x[1]-u.x[0])/o.offsetWidth*y.x+u.x[0],y:(u.y[1]-u.y[0])/o.offsetHeight*y.y+u.y[0],z:(u.z[1]-u.z[0])/o.offsetHeight*y.y+u.z[0]},rotate:{x:(h.x[1]-h.x[0])/o.offsetHeight*y.y+h.x[0],y:(h.y[1]-h.y[0])/o.offsetWidth*y.x+h.y[0],z:(h.z[1]-h.z[0])/o.offsetWidth*y.x+h.z[0]}},v=o.querySelectorAll(l[c].className),m=l[c].transition?l[c].transition:e,d=i(x);s(d,v),f(m,v)}});var a=function(t){var r={};for(var e in t)t[e]?"number"==typeof t[e]&&(r[e]=[-1*t[e],t[e]]):r[e]=[0,0];return r},o=function(t,n){for(var a={translate:r,rotate:r},o=0;o<n.children.length;o++){var l=t.querySelectorAll(n.children[o].className),y=n.children[o].transition?n.children[o].transition:e,c=i(a);s(c,l),f(y,l)}},i=function(t){var r=t.rotate,e=t.translate,n=1,a=1,o=0,i=0,s=Math.cos(r.y*(Math.PI/180)),f=Math.sin(r.y*(Math.PI/180)),l=Math.cos(r.x*(Math.PI/180)),y=Math.sin(r.x*(Math.PI/180)),c=Math.cos(r.z*(Math.PI/180)),h=Math.sin(r.z*(Math.PI/180)),u=new Array(16);u[0]=s*c*n,u[1]=-1*h,u[2]=f,u[3]=o,u[4]=h,u[5]=l*c*a,u[6]=y,u[7]=i,u[8]=-1*f,u[9]=-1*y,u[10]=s*l,u[11]=0,u[12]=e.x,u[13]=e.y,u[14]=e.z,u[15]=1;for(var x="",v=0;v<u.length;v++){var m=0==v?"":",";x=x.concat(m+u[v])}return x},s=function(t,r){Array.prototype.forEach.call(r,function(r,e){r.style[transformProperty]="matrix3d("+t+")"})},f=function(t,r){Array.prototype.forEach.call(r,function(r,e){r.style[transitionProperty]=t})}}var transformPrefix=["transform","msTransform","webkitTransform","mozTransform","oTransform"],transitionPrefix=["transition","msTransition","webkitTransition","mozTransition","oTransition"],transformProperty=getPrefix(transformPrefix),transitionProperty=getPrefix(transitionPrefix); | ||
"use strict";function GHover(t){if(Array.isArray(t))for(var r=0;r<t.length;r++)startHover(t[r]);else startHover(t)}function getCSSPrefix(t){for(var r=0;r<t.length;r++)if("undefined"!=typeof document.body.style[t[r]])return t[r];return null}function startHover(t){var r={x:0,y:0,z:0},e="all 0.2s ease",n=document.querySelector(t.selector);n.style.perspective="1000px",n.style[transformProperty]="rotateZ(0deg) translateZ(0)",n.addEventListener("mouseleave",function(r){return o(r.currentTarget,t)}),n.addEventListener("mousemove",function(n){for(var o=n.currentTarget,l=t.children,y={x:n.pageX-o.offsetLeft,y:n.pageY-o.offsetTop},c=0;c<l.length;c++){var h=l[c].rotate?l[c].rotate:r,u=l[c].translate?l[c].translate:r;u=a(u),h=a(h);var x={translate:{x:(u.x[1]-u.x[0])/o.offsetWidth*y.x+u.x[0],y:(u.y[1]-u.y[0])/o.offsetHeight*y.y+u.y[0],z:(u.z[1]-u.z[0])/o.offsetHeight*y.y+u.z[0]},rotate:{x:(h.x[1]-h.x[0])/o.offsetHeight*y.y+h.x[0],y:(h.y[1]-h.y[0])/o.offsetWidth*y.x+h.y[0],z:(h.z[1]-h.z[0])/o.offsetWidth*y.x+h.z[0]}},v=o.querySelectorAll(l[c].className),m=l[c].transition?l[c].transition:e,d=i(x);s(d,v),f(m,v)}});var a=function(t){var r={};for(var e in t)t[e]?"number"==typeof t[e]&&(r[e]=[-1*t[e],t[e]]):r[e]=[0,0];return r},o=function(t,n){for(var a={translate:r,rotate:r},o=0;o<n.children.length;o++){var l=t.querySelectorAll(n.children[o].className),y=n.children[o].transition?n.children[o].transition:e,c=i(a);s(c,l),f(y,l)}},i=function(t){var r=t.rotate,e=t.translate,n=1,a=1,o=0,i=0,s=Math.cos(r.y*(Math.PI/180)),f=Math.sin(r.y*(Math.PI/180)),l=Math.cos(r.x*(Math.PI/180)),y=Math.sin(r.x*(Math.PI/180)),c=Math.cos(r.z*(Math.PI/180)),h=Math.sin(r.z*(Math.PI/180)),u=new Array(16);u[0]=s*c*n,u[1]=-1*h,u[2]=f,u[3]=o,u[4]=h,u[5]=l*c*a,u[6]=y,u[7]=i,u[8]=-1*f,u[9]=-1*y,u[10]=s*l,u[11]=0,u[12]=e.x,u[13]=e.y,u[14]=e.z,u[15]=1;for(var x="",v=0;v<u.length;v++){var m=0==v?"":",";x=x.concat(m+u[v])}return x},s=function(t,r){Array.prototype.forEach.call(r,function(r,e){r.style[transformProperty]="matrix3d("+t+")"})},f=function(t,r){Array.prototype.forEach.call(r,function(r,e){r.style[transitionProperty]=t})}}var transformPrefix=["transform","msTransform","webkitTransform","mozTransform","oTransform"],transitionPrefix=["transition","msTransition","webkitTransition","mozTransition","oTransition"],transformProperty=getCSSPrefix(transformPrefix),transitionProperty=getCSSPrefix(transitionPrefix); |
{ | ||
"name": "ghover", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "GHover is a lightweight javascript tool to make awesome 3D hover effects on your website", | ||
"main": "lib/ghover.js", | ||
"repository": { | ||
"url": "https://github.com/GA-MO/g-hover/", | ||
"url": "https://github.com/GA-MO/g-hover.git", | ||
"type": "git" | ||
@@ -19,5 +19,7 @@ }, | ||
"scripts": { | ||
"commit": "git-cz", | ||
"dev": "gulp", | ||
"build": "gulp build", | ||
"deploy": "npm publish" | ||
"deploy": "npm publish", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
}, | ||
@@ -27,2 +29,5 @@ "files": [ | ||
], | ||
"czConfig": { | ||
"path": "node_modules/cz-conventional-changelog" | ||
}, | ||
"dependencies": {}, | ||
@@ -33,2 +38,4 @@ "devDependencies": { | ||
"browser-sync": "^2.9.10", | ||
"commitizen": "^2.9.6", | ||
"cz-conventional-changelog": "^1.2.0", | ||
"gulp": "^3.9.0", | ||
@@ -46,4 +53,5 @@ "gulp-autoprefixer": "^3.0.2", | ||
"gulp-uglify": "^1.4.1", | ||
"gulp-util": "^3.0.6" | ||
"gulp-util": "^3.0.6", | ||
"semantic-release": "^6.3.2" | ||
} | ||
} | ||
} |
@@ -11,3 +11,3 @@ # GHover | ||
``` | ||
$ npm install ghover --save | ||
$ npm i ghover --save | ||
``` | ||
@@ -14,0 +14,0 @@ |
Sorry, the diff of this file is not supported yet
5429
19