ht-cssanimation.js 5.1 KB

1
  1. !function(f,j,G){"use strict";var A,E,M="ht",T=f[M],b=T.Default,K=["transitionend","webkitTransitionEnd"],P=null,i=f.parseInt,Z=f.isNaN,m={linear:"cubic-bezier(0.250, 0.250, 0.750, 0.750)",ease:"cubic-bezier(0.250, 0.100, 0.250, 1.000)","ease-in":"cubic-bezier(0.420, 0.000, 1.000, 1.000)","ease-out":"cubic-bezier(0.000, 0.000, 0.580, 1.000)","ease-in-out":"cubic-bezier(0.420, 0.000, 0.580, 1.000)","ease-in-quad":"cubic-bezier(0.550, 0.085, 0.680, 0.530)","ease-in-cubic":"cubic-bezier(0.550, 0.055, 0.675, 0.190)","ease-in-quart":"cubic-bezier(0.895, 0.030, 0.685, 0.220)","ease-in-quint":"cubic-bezier(0.755, 0.050, 0.855, 0.060)","ease-in-sine":"cubic-bezier(0.470, 0.000, 0.745, 0.715)","ease-in-expo":"cubic-bezier(0.950, 0.050, 0.795, 0.035)","ease-in-circ":"cubic-bezier(0.600, 0.040, 0.980, 0.335)","ease-in-back":"cubic-bezier(0.600, -0.280, 0.735, 0.045)","ease-out-quad":"cubic-bezier(0.250, 0.460, 0.450, 0.940)","ease-out-cubic":"cubic-bezier(0.215, 0.610, 0.355, 1.000)","ease-out-quart":"cubic-bezier(0.165, 0.840, 0.440, 1.000)","ease-out-quint":"cubic-bezier(0.230, 1.000, 0.320, 1.000)","ease-out-sine":"cubic-bezier(0.390, 0.575, 0.565, 1.000)","ease-out-expo":"cubic-bezier(0.190, 1.000, 0.220, 1.000)","ease-out-circ":"cubic-bezier(0.075, 0.820, 0.165, 1.000)","ease-out-back":"cubic-bezier(0.175, 0.885, 0.320, 1.275)","ease-in-out-quad":"cubic-bezier(0.455, 0.030, 0.515, 0.955)","ease-in-out-cubic":"cubic-bezier(0.645, 0.045, 0.355, 1.000)","ease-in-out-quart":"cubic-bezier(0.770, 0.000, 0.175, 1.000)","ease-in-out-quint":"cubic-bezier(0.860, 0.000, 0.070, 1.000)","ease-in-out-sine":"cubic-bezier(0.445, 0.050, 0.550, 0.950)","ease-in-out-expo":"cubic-bezier(1.000, 0.000, 0.000, 1.000)","ease-in-out-circ":"cubic-bezier(0.785, 0.135, 0.150, 0.860)","ease-in-out-back":"cubic-bezier(0.680, -0.550, 0.265, 1.550)"},D=b.animate=function(L){var M=this;return M instanceof D?("string"==typeof L&&(L=document.querySelector(L)),A===G&&(A=function(){var e={webkitTransform:"-webkit-transform",msTransform:"-ms-transform",transform:"transform"},o=document.createElement("p");for(var N in e)if(P!=o.style[N])return e[N];return P}()),E===G&&(E=function(){var c=document.body.style;return"transition"in c||"webkitTransition"in c}()),M._el=L,M.$1m={},M.$2m=[],M.$3m=[],M.duration(),M.$4m=new T.Notifier,void 0):new D(L)};b.def(D,j,{transform:function(C){var x=this;return x.$3m.push(C),"-webkit-transform"===A?(x.$5m(A,x.$3m.join(" ")),x.$6m(A),x.$5m("transform",x.$3m.join(" ")),x.$6m("transform")):(x.$5m(A,x.$3m.join(" ")),x.$6m(A)),x},translate:function(p,Y){p=p==P?0:p,Y=Y==P?0:Y;var S=Z(p)?p:p+"px",T=Z(Y)?Y:Y+"px";return this.transform("translate("+S+", "+T+")")},translateX:function(u){return u=u==P?0:u,u=Z(u)?u:u+"px",this.transform("translateX("+u+")")},tx:function(i){this.translateX(i)},translateY:function(X){return X=X==P?0:X,X=Z(X)?X:X+"px",this.transform("translateY("+X+")")},ty:function(j){this.translateY(j)},scale:function(T,o){return T=Z(T)?1:T,o=o==P||Z(o)?T:o,this.transform("scale("+T+", "+o+")")},scaleX:function(r){return r=Z(r)?1:r,this.transform("scaleX("+r+")")},scaleY:function(e){return e=Z(e)?1:e,this.transform("scaleY("+e+")")},rotate:function(b){return b=i(b)||0,this.transform("rotate("+b+"deg)")},skew:function(p,v){return p=i(p)||0,v=i(v)||0,this.transform("skew("+p+"deg, "+v+"deg)")},skewX:function(V){return V=i(V)||0,this.transform("skewX("+V+"deg)")},skewY:function(V){return V=i(V)||0,this.transform("skewY("+V+"deg)")},$7m:function(H){this._el.$17m=H;for(var c=0;c<K.length;c++)this._el.addEventListener(K[c],H)},$8m:function(W){for(var P=0;P<K.length;P++)this._el.removeEventListener(K[P],W);delete this._el.$17m},$9m:function(Y){function I(){O.$8m(I),Y.apply(N,arguments)}var O=this,N=O._el;N.$17m&&O.$8m(N.$17m),O.$7m(I)},$5m:function(C,t){this.$1m[C]=t},$10m:function(){var I=this.$1m,e=this._el.style;for(var L in I){var k=I[L];if(L.indexOf("transition-property")>=0){var J=e.getPropertyValue(L);J&&(J.indexOf(k)>=0?k=J:k.indexOf(J)>=0||(k=J+", "+k))}e.setProperty(L,k)}},$11m:function(t,H){this.$5m("-webkit-"+t,H),this.$5m(t,H)},$12m:function(){var V=this._el.style;V.webkitTransition=V.transition=""},duration:function(d){return Z(d)&&(d=200),this.$14m=d,this.$11m("transition-duration",d+"ms"),this},delay:function(l){return l=i(l)||0,this.$11m("transition-delay",l+"ms"),this},ease:function(X){return X=m[X]||X||"ease",this.$11m("transition-timing-function",X),this},$6m:function(L){this.$2m.indexOf(L)<0&&this.$2m.push(L)},set:function(v,T){return this.$5m(v,T),this.$6m(v),this},then:function(Q){var s=this,e=this.$4m;if(!(Q instanceof D)){var L=new D(s._el);return L.$3m=this.$3m.slice(0),s.then(L),L.$15m=s,s.$16m=L,L}return e.add(function(w){"end"===w.kind&&Q.end(s.$13m)}),this},pop:function(){return this.$15m},end:function(L){var S=this,N=S.$4m;S.$11m("transition-property",S.$2m.join(", ")),S.$10m(),L&&(S.$13m=L);var W=function(u){S.$12m(),N.fire({kind:"end"}),S.$16m||S.$13m&&S.$13m.call(S,u)};0!==S.$14m&&E?S.$9m(function(z){b.callLater(function(){W(z)},P,P,0)}):W({target:S._el,mock:1})}})}("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:this,Object);