-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanim-sequence.min.js
More file actions
2 lines (2 loc) · 3.61 KB
/
anim-sequence.min.js
File metadata and controls
2 lines (2 loc) · 3.61 KB
1
2
/*! AnimSequence v1.0.11 (c) anseki https://anseki.github.io/anim-sequence/ */
var AnimSequence=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";r.r(t);var n,a={ease:[.25,.1,.25,1],linear:[0,0,1,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]},o=1e3/60/2,i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,o)},u=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||function(e){clearTimeout(e)},f=Number.isFinite||function(e){return"number"==typeof e&&window.isFinite(e)},l=[],s=0;function m(){var e=Date.now(),t=!1;n&&(u.call(window,n),n=null),l.forEach(function(r){var n,a,i;if(r.framesStart){if((n=e-r.framesStart)>=r.duration&&r.count&&r.loopsLeft<=1)return i=r.frames[r.lastFrame=r.reverse?0:r.frames.length-1],r.frameCallback(i.value,!0,i.timeRatio,i.outputRatio),void(r.framesStart=null);if(n>r.duration){if(a=Math.floor(n/r.duration),r.count){if(a>=r.loopsLeft)return i=r.frames[r.lastFrame=r.reverse?0:r.frames.length-1],r.frameCallback(i.value,!0,i.timeRatio,i.outputRatio),void(r.framesStart=null);r.loopsLeft-=a}r.framesStart+=r.duration*a,n=e-r.framesStart}r.reverse&&(n=r.duration-n),i=r.frames[r.lastFrame=Math.round(n/o)],!1!==r.frameCallback(i.value,!1,i.timeRatio,i.outputRatio)?t=!0:r.framesStart=null}}),t&&(n=i.call(window,m))}function c(e,t){e.framesStart=Date.now(),null!=t&&(e.framesStart-=e.duration*(e.reverse?1-t:t)),e.loopsLeft=e.count,e.lastFrame=null,m()}var d={add:function(e,t,r,n,i,u,f){var m,d,p,v,w,b,y,S=++s;function F(e){var t=e*e,r=t*e,n=1-e,a=3*(n*n)*e,o=3*n*t;return{x:a*i[0]+o*i[2]+r,y:a*i[1]+o*i[3]+r}}function R(t,r){return{value:e(r),timeRatio:t,outputRatio:r}}if("string"==typeof i&&(i=a[i]),e=e||function(){},r<o)d=[R(0,0),R(1,1)];else{if(p=o/r,d=[R(0,0)],0===i[0]&&0===i[1]&&1===i[2]&&1===i[3])for(w=p;w<=1;w+=p)d.push(R(w,w));else for(w=p,b=v=p/10;b<=1;b+=v)(y=F(b)).x>=w&&(d.push(R(y.x,y.y)),w+=p);d.push(R(1,1))}return m={animId:S,frameCallback:t,duration:r,count:n,frames:d,reverse:!!u},l.push(m),!1!==f&&c(m,f),S},remove:function(e){var t;l.some(function(r,n){return r.animId===e&&(t=n,r.framesStart=null,!0)})&&l.splice(t,1)},start:function(e,t,r){l.some(function(n){return n.animId===e&&(n.reverse=!!t,c(n,r),!0)})},stop:function(e,t){var r;return l.some(function(n){return n.animId===e&&(t?null!=n.lastFrame&&(r=n.frames[n.lastFrame].timeRatio):(r=(Date.now()-n.framesStart)/n.duration,n.reverse&&(r=1-r),r<0?r=0:r>1&&(r=1)),n.framesStart=null,!0)}),r},validTiming:function(e){return"string"==typeof e?a[e]:Array.isArray(e)&&[0,1,2,3].every(function(t){return f(e[t])&&e[t]>=0&&e[t]<=1})?[e[0],e[1],e[2],e[3]]:null}};t.default=d}]).default;