forked from huangtianle/201712
-
Notifications
You must be signed in to change notification settings - Fork 0
/
animate.min.js
1 lines (1 loc) · 4.28 KB
/
animate.min.js
1
~function(){function c(c){var e,f,g,h,i,j,k,l,m,d={curEle:null,target:null,duration:1e3,effect:b.Linear,callBack:null};for(e in c)c.hasOwnProperty(e)&&(d[e]=c[e]);f=d.curEle,g=d.target,h=d.duration,i=d.effect,j=d.callBack,k=null,l={},m={};for(e in g)g.hasOwnProperty(e)&&(l[e]=a.css(f,e),m[e]=g[e]-l[e]);clearInterval(f.animateTimer),f.animateTimer=setInterval(function(){var b,c;if(k+=17,k>=h)return a.css(f,g),clearInterval(f.animateTimer),j&&j.call(f),void 0;b={};for(c in g)g.hasOwnProperty(c)&&(b[c]=i(k,l[c],m[c],h));a.css(f,b)},17)}var a=function(){function b(b,c){var d=null,e=null;if(a)d=window.getComputedStyle(b,null)[c];else{if("opacity"===c)return d=b.currentStyle["filter"],e=/^alpha\(opacity=(.+)\)$/i,e.test(d)?e.exec(d)[1]/100:1;d=b.currentStyle[c]}return e=/^-?\d+(.\d+)?(pt|px|rem|em)?$/i,e.test(d)?parseFloat(d):d}function c(a,b,c){return"opacity"===b?(a.style.opacity=c,a.style.filter="alpha(opacity="+100*c+")",void 0):(isNaN(c)||/(fontWeight|lineHeight|zoom|zIndex)/i.test(b)?null:c+="px",a.style[b]=c,void 0)}function d(a,b){if("[object Object]"===Object.prototype.toString.call(b))for(var d in b)b.hasOwnProperty(d)&&c(a,d,b[d])}function e(){var a=arguments.length,e=Object.prototype.toString.call(arguments[1]),f=b;return a>=3?f=c:2===a&&"[object Object]"===e?f=d:null,f.apply(this,arguments)}var a="getElementsByClassName"in document;return{css:e}}(),b={Linear:function(a,b,c,d){return c*a/d+b},Bounce:{easeIn:function(a,c,d,e){return d-b.Bounce.easeOut(e-a,0,d,e)+c},easeOut:function(a,b,c,d){return(a/=d)<1/2.75?c*7.5625*a*a+b:2/2.75>a?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:2.5/2.75>a?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},easeInOut:function(a,c,d,e){return e/2>a?.5*b.Bounce.easeIn(2*a,0,d,e)+c:.5*b.Bounce.easeOut(2*a-e,0,d,e)+.5*d+c}},Quad:{easeIn:function(a,b,c,d){return c*(a/=d)*a+b},easeOut:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOut:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}},Cubic:{easeIn:function(a,b,c,d){return c*(a/=d)*a*a+b},easeOut:function(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b},easeInOut:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a+b:c/2*((a-=2)*a*a+2)+b}},Quart:{easeIn:function(a,b,c,d){return c*(a/=d)*a*a*a+b},easeOut:function(a,b,c,d){return-c*((a=a/d-1)*a*a*a-1)+b},easeInOut:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a+b:-c/2*((a-=2)*a*a*a-2)+b}},Quint:{easeIn:function(a,b,c,d){return c*(a/=d)*a*a*a*a+b},easeOut:function(a,b,c,d){return c*((a=a/d-1)*a*a*a*a+1)+b},easeInOut:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a*a+b:c/2*((a-=2)*a*a*a*a+2)+b}},Sine:{easeIn:function(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b},easeOut:function(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b},easeInOut:function(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b}},Expo:{easeIn:function(a,b,c,d){return 0==a?b:c*Math.pow(2,10*(a/d-1))+b},easeOut:function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},easeInOut:function(a,b,c,d){return 0==a?b:a==d?b+c:(a/=d/2)<1?c/2*Math.pow(2,10*(a-1))+b:c/2*(-Math.pow(2,-10*--a)+2)+b}},Circ:{easeIn:function(a,b,c,d){return-c*(Math.sqrt(1-(a/=d)*a)-1)+b},easeOut:function(a,b,c,d){return c*Math.sqrt(1-(a=a/d-1)*a)+b},easeInOut:function(a,b,c,d){return(a/=d/2)<1?-c/2*(Math.sqrt(1-a*a)-1)+b:c/2*(Math.sqrt(1-(a-=2)*a)+1)+b}},Back:{easeIn:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*(a/=d)*a*((e+1)*a-e)+b},easeOut:function(a,b,c,d,e){return void 0==e&&(e=1.70158),c*((a=a/d-1)*a*((e+1)*a+e)+1)+b},easeInOut:function(a,b,c,d,e){return void 0==e&&(e=1.70158),(a/=d/2)<1?c/2*a*a*(((e*=1.525)+1)*a-e)+b:c/2*((a-=2)*a*(((e*=1.525)+1)*a+e)+2)+b}},Elastic:{easeIn:function(a,b,c,d,e,f){if(0==a)return b;if(1==(a/=d))return b+c;f||(f=.3*d);var g;return!e||e<Math.abs(c)?(e=c,g=f/4):g=f/(2*Math.PI)*Math.asin(c/e),-(e*Math.pow(2,10*(a-=1))*Math.sin((a*d-g)*2*Math.PI/f))+b},easeOut:function(a,b,c,d,e,f){if(0==a)return b;if(1==(a/=d))return b+c;f||(f=.3*d);var g;return!e||e<Math.abs(c)?(e=c,g=f/4):g=f/(2*Math.PI)*Math.asin(c/e),e*Math.pow(2,-10*a)*Math.sin((a*d-g)*2*Math.PI/f)+c+b},easeInOut:function(a,b,c,d,e,f){if(0==a)return b;if(2==(a/=d/2))return b+c;f||(f=d*.3*1.5);var g;return!e||e<Math.abs(c)?(e=c,g=f/4):g=f/(2*Math.PI)*Math.asin(c/e),1>a?-.5*e*Math.pow(2,10*(a-=1))*Math.sin((a*d-g)*2*Math.PI/f)+b:.5*e*Math.pow(2,-10*(a-=1))*Math.sin((a*d-g)*2*Math.PI/f)+c+b}}};window.animateEffect=b,window.animate=c}();