1 line
6.2 KiB
JavaScript
1 line
6.2 KiB
JavaScript
!function(X){"use strict";var H="ht",u=X[H],e=u.Default,I="prototype",t=u.DataModel[I],y=u.Data[I],D=null,z=function(K){return"set"+K.charAt(0).toUpperCase()+K.slice(1)};e.getEasing=function(d){var q=D;return d.indexOf(".")>=0?(d=d.split("."),q=b[d[0]][d[1]]):q=b[d],function(l){return q(l,0,1,1)}},e.getCommonEasing=function(X){var e=D;return X.indexOf(".")>=0?(X=X.split("."),e=b[X[0]][X[1]]):e=b[X],e},y.setAnimation=function(P){var f=this._animation;this._animation=P,f!==P&&(this._animationprocess=D,this._animationstatus=D),this.fp("animation",f,P)},y.getAnimation=function(){return this._animation},y.pauseAnimation=function(){this._pauseAnimation||(this._pauseAnimation=!0,this._pauseTime=Date.now())},y.resumeAnimation=function(){delete this._pauseAnimation},X.requestAnimFrame=function(){return X.requestAnimationFrame||X.webkitRequestAnimationFrame||X.mozRequestAnimationFrame||function(W){X.setTimeout(W,1e3/60)}}();var m=X.requestAnimFrame,J=X.setInterval;t.setAnimationInterval=function(R){var g=this;g.$2a=R,g.$1a!=D&&(clearInterval(g.$1a),delete g.$1a,g.enableAnimation(R))},t.getAnimationInterval=function(){return this.$2a||"animationFrame"},t.getDataAnimation=function(A){return A.getAnimation()},t.enableAnimation=function(O){var i=this,q=i.getDatas();if(i.$1a==D){O&&i.setAnimationInterval(O),O=i.getAnimationInterval();var Q=function(){var x=i.getAnimationInterval();q.each(function(p){var s=i.getDataAnimation(p);if(p.setAnimation(s),s&&!p._pauseAnimation){var h=s.start;p._animationstatus=p._animationstatus||{},p._animationprocess=p._animationprocess||h.slice(0);for(var L=p._animationstatus,Y=p._animationprocess,J=0;J<Y.length;J++)if(null!=Y[J]){var E;E=L[J]?L[J]:L[J]={$5a:0,$6a:0,$7a:0,$8a:0};var X=s[Y[J]],$=X.property,I=X.accessType,K=X.from,F=X.to,j=X.easing||"Quad.easeOut",C=E.$5a,P=X.frames||60,U=X.repeat||0,H=X.duration,n=X.delay||0,O=X.interval,k=E.$6a,N=X.onUpdate,G=X.onComplete,R=!1,m=function(){var S;S=H!=D?e.getCommonEasing(j)(Date.now()-E._startTime,K,F-K,H):e.getCommonEasing(j)(C,K,F-K,P),N?N.call(p,S):I?"style"===I?p.s($,S):"attr"===I?p.a($,S):"field"===I&&(p[$]=S):p[z($)](S),R=!0},_=function(){E._startTime==D&&(E._startTime=Date.now());var f=p._pauseTime;f!=D&&(E._startTime+=Date.now()-f),J==Y.length-1&&delete p._pauseTime,O!=D?E.$7a>=O?(E.$7a=0,m()):E.$7a+=isNaN(x)?16.6666:x:m()};if(n?E.$8a>=n?_():E.$8a+=isNaN(x)?16.6666:x:_(),R)if(H!=D){if(Date.now()-E._startTime>H)if(U===!0)E._startTime=Date.now();else if(E._startTime=Date.now(),k=E.$6a=k+1,k>=U)if(G&&G.call(p),X.next)L[J]=D,Y[J]=X.next;else{L[J]=D,Y[J]=D;for(var t=!0,V=0;V<Y.length;V++)null!=Y[V]&&(t=!1);t&&(p.setAnimation(D),p._animationstatus=D,p._animationprocess=D,p._pauseTime=D)}}else if(C=E.$5a=C+1,C>P)if(U===!0)C=E.$5a=0;else if(C=E.$5a=0,k=E.$6a=k+1,k>=U)if(G&&G.call(p),X.next)L[J]=D,Y[J]=X.next;else{L[J]=D,Y[J]=D;for(var t=!0,V=0;V<Y.length;V++)null!=Y[V]&&(t=!1);t&&(p.setAnimation(D),p._animationstatus=D,p._animationprocess=D)}}}}),"animationFrame"===x&&i.$1a!=D&&(i.$1a=m(Q))};i.$1a="animationFrame"===O?m(Q):J(Q,O)}},t.disableAnimation=function(){var W=this,I=W.getAnimationInterval();"animationFrame"===I||clearInterval(W.$1a),delete W.$1a};var b={Linear:function(X,p,o,l){return o*X/l+p},Quad:{easeIn:function(h,U,u,T){return u*(h/=T)*h+U},easeOut:function(N,X,t,a){return-t*(N/=a)*(N-2)+X},easeInOut:function(Y,E,k,d){return(Y/=d/2)<1?k/2*Y*Y+E:-k/2*(--Y*(Y-2)-1)+E}},Cubic:{easeIn:function(Q,V,z,n){return z*(Q/=n)*Q*Q+V},easeOut:function(M,v,c,A){return c*((M=M/A-1)*M*M+1)+v},easeInOut:function(e,U,k,o){return(e/=o/2)<1?k/2*e*e*e+U:k/2*((e-=2)*e*e+2)+U}},Quart:{easeIn:function(u,Z,f,x){return f*(u/=x)*u*u*u+Z},easeOut:function(K,v,Y,P){return-Y*((K=K/P-1)*K*K*K-1)+v},easeInOut:function(S,y,G,b){return(S/=b/2)<1?G/2*S*S*S*S+y:-G/2*((S-=2)*S*S*S-2)+y}},Quint:{easeIn:function(d,m,i,j){return i*(d/=j)*d*d*d*d+m},easeOut:function(X,k,C,R){return C*((X=X/R-1)*X*X*X*X+1)+k},easeInOut:function(Z,d,I,r){return(Z/=r/2)<1?I/2*Z*Z*Z*Z*Z+d:I/2*((Z-=2)*Z*Z*Z*Z+2)+d}},Sine:{easeIn:function(T,k,S,h){return-S*Math.cos(T/h*(Math.PI/2))+S+k},easeOut:function(D,d,s,Y){return s*Math.sin(D/Y*(Math.PI/2))+d},easeInOut:function(c,D,M,l){return-M/2*(Math.cos(Math.PI*c/l)-1)+D}},Expo:{easeIn:function($,l,A,h){return 0==$?l:A*Math.pow(2,10*($/h-1))+l},easeOut:function(X,q,l,E){return X==E?q+l:l*(-Math.pow(2,-10*X/E)+1)+q},easeInOut:function(Z,B,l,J){return 0==Z?B:Z==J?B+l:(Z/=J/2)<1?l/2*Math.pow(2,10*(Z-1))+B:l/2*(-Math.pow(2,-10*--Z)+2)+B}},Circ:{easeIn:function(w,m,V,G){return-V*(Math.sqrt(1-(w/=G)*w)-1)+m},easeOut:function(h,G,P,T){return P*Math.sqrt(1-(h=h/T-1)*h)+G},easeInOut:function(z,H,P,l){return(z/=l/2)<1?-P/2*(Math.sqrt(1-z*z)-1)+H:P/2*(Math.sqrt(1-(z-=2)*z)+1)+H}},Elastic:{easeIn:function(H,G,C,K,i,w){var U;return 0==H?G:1==(H/=K)?G+C:("undefined"==typeof w&&(w=.3*K),!i||i<Math.abs(C)?(U=w/4,i=C):U=w/(2*Math.PI)*Math.asin(C/i),-(i*Math.pow(2,10*(H-=1))*Math.sin((H*K-U)*2*Math.PI/w))+G)},easeOut:function(L,k,A,t,n,Y){var f;return 0==L?k:1==(L/=t)?k+A:("undefined"==typeof Y&&(Y=.3*t),!n||n<Math.abs(A)?(n=A,f=Y/4):f=Y/(2*Math.PI)*Math.asin(A/n),n*Math.pow(2,-10*L)*Math.sin((L*t-f)*2*Math.PI/Y)+A+k)},easeInOut:function(y,V,B,c,T,v){var R;return 0==y?V:2==(y/=c/2)?V+B:("undefined"==typeof v&&(v=c*.3*1.5),!T||T<Math.abs(B)?(T=B,R=v/4):R=v/(2*Math.PI)*Math.asin(B/T),1>y?-.5*T*Math.pow(2,10*(y-=1))*Math.sin((y*c-R)*2*Math.PI/v)+V:.5*T*Math.pow(2,-10*(y-=1))*Math.sin((y*c-R)*2*Math.PI/v)+B+V)}},Back:{easeIn:function(n,R,W,b,m){return"undefined"==typeof m&&(m=1.70158),W*(n/=b)*n*((m+1)*n-m)+R},easeOut:function(E,s,R,H,F){return"undefined"==typeof F&&(F=1.70158),R*((E=E/H-1)*E*((F+1)*E+F)+1)+s},easeInOut:function(T,F,m,c,O){return"undefined"==typeof O&&(O=1.70158),(T/=c/2)<1?m/2*T*T*(((O*=1.525)+1)*T-O)+F:m/2*((T-=2)*T*(((O*=1.525)+1)*T+O)+2)+F}},Bounce:{easeIn:function(n,U,L,E){return L-b.Bounce.easeOut(E-n,0,L,E)+U},easeOut:function(F,j,f,E){return(F/=E)<1/2.75?f*7.5625*F*F+j:2/2.75>F?f*(7.5625*(F-=1.5/2.75)*F+.75)+j:2.5/2.75>F?f*(7.5625*(F-=2.25/2.75)*F+.9375)+j:f*(7.5625*(F-=2.625/2.75)*F+.984375)+j},easeInOut:function(E,s,p,S){return S/2>E?.5*b.Bounce.easeIn(2*E,0,p,S)+s:.5*b.Bounce.easeOut(2*E-S,0,p,S)+.5*p+s}}}}("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:(0,eval)("this"),Object); |