-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtweeno.min.js
1 lines (1 loc) · 10 KB
/
tweeno.min.js
1
!function(a){if("object"==typeof exports)module.exports=a();else if("function"==typeof define&&define.amd)define(a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.Tweeno=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){b.exports={Tween:a("./src/tween.js"),Filter:a("./src/filter.js"),Queue:a("./src/queue.js"),Interpolation:a("./src/interpolation.js"),Easing:a("./src/easing.js")}},{"./src/easing.js":2,"./src/filter.js":3,"./src/interpolation.js":4,"./src/queue.js":5,"./src/tween.js":6}],2:[function(a,b){var c={Linear:{None:function(a){return a}},Quadratic:{In:function(a){return a*a},Out:function(a){return a*(2-a)},InOut:function(a){return(a*=2)<1?.5*a*a:-.5*(--a*(a-2)-1)}},Cubic:{In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a:.5*((a-=2)*a*a+2)}},Quartic:{In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return(a*=2)<1?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)}},Quintic:{In:function(a){return a*a*a*a*a},Out:function(a){return--a*a*a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)}},Sinusoidal:{In:function(a){return 1-Math.cos(a*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return.5*(1-Math.cos(Math.PI*a))}},Exponential:{In:function(a){return 0===a?0:Math.pow(1024,a-1)},Out:function(a){return 1===a?1:1-Math.pow(2,-10*a)},InOut:function(a){return 0===a?0:1===a?1:(a*=2)<1?.5*Math.pow(1024,a-1):.5*(-Math.pow(2,-10*(a-1))+2)}},Circular:{In:function(a){return 1-Math.sqrt(1-a*a)},Out:function(a){return Math.sqrt(1- --a*a)},InOut:function(a){return(a*=2)<1?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)}},Elastic:{In:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),-(c*Math.pow(2,10*(a-=1))*Math.sin(2*(a-b)*Math.PI/d)))},Out:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),c*Math.pow(2,-10*a)*Math.sin(2*(a-b)*Math.PI/d)+1)},InOut:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),(a*=2)<1?-.5*c*Math.pow(2,10*(a-=1))*Math.sin(2*(a-b)*Math.PI/d):c*Math.pow(2,-10*(a-=1))*Math.sin(2*(a-b)*Math.PI/d)*.5+1)}},Back:{In:function(a){var b=1.70158;return a*a*((b+1)*a-b)},Out:function(a){var b=1.70158;return--a*a*((b+1)*a+b)+1},InOut:function(a){var b=2.5949095;return(a*=2)<1?.5*a*a*((b+1)*a-b):.5*((a-=2)*a*((b+1)*a+b)+2)}},Bounce:{In:function(a){return 1-c.Bounce.Out(1-a)},Out:function(a){return 1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},InOut:function(a){return.5>a?.5*c.Bounce.In(2*a):.5*c.Bounce.Out(2*a-1)+.5}}};b.exports=c},{}],3:[function(a,b){"use strict";var c=function(a){a=a||{},this.format=a.format||this.format,this.placeholder=a.placeholder||this.placeholder,this.placeholderTypes=a.placeholderTypes||[].concat(this.placeholderTypes),this._formatArray=this.format.split(this.placeholder)};c.prototype._formatArray=null,c.prototype.format="rgba(%,%,%,%)",c.prototype.placeholder="%",c.prototype.placeholderTypes=["int","int","int","float"],c.prototype.to=null,c.prototype.from=null,c.prototype.stringToArray=function(a){var b=a.match(/[+-]?[\d]+(\.[\d]+)?/g);return b.map(parseFloat)},c.prototype.validateArrayLength=function(a,b,c){c=c||"",b=b||"",c&&(c=' set to the "'+c+'" param'),b&&(b=' of string "'+b+'"');var d=this._formatArray.length-1;if(d>a)throw new Error("value array length ( "+a+" )"+b+c+" is less than the number of format placeholders ( "+d+" ) in "+this.format);if(a>d)throw new Error("value array length ( "+a+" )"+b+c+" is greater than the number of format placeholders ( "+d+" ) in "+this.format)},c.prototype.arrayToString=function(a){var b,c=this._formatArray,d=c.length,e=[];for(b=0;d>b;b++)"int"===this.placeholderTypes[b]&&(a[b]=Math.round(a[b])),e.push(c[b]),e.push(a[b]);return e.join("")},c.prototype.start=function(a,b){this.from=a,this.to=b,this.arrayFrom=this.stringToArray(a),this.validateArrayLength(this.arrayFrom.length,a,"arrayFrom");var c;if(b instanceof Array){c=[],b=[a].concat(b);var d,e=b.length;for(d=0;e>d;d++){var f=this.stringToArray(b[d]);this.validateArrayLength(f.length,b[d],"arrayTo"),c[d]=f}this.arrayToIndexedInterpolated=this.getIndexedInterpolationData(c)}else c=this.stringToArray(b),this.validateArrayLength(c.length,b,"arrayTo");this.arrayTo=c},c.prototype.getIndexedInterpolationData=function(a){var b,c,d=[],e=a.length;for(b=0;e>b;b++){var f=a[b],g=f.length;for(c=0;g>c;c++)"undefined"==typeof d[c]&&(d[c]=[]),d[c].push(f[c])}return d},c.prototype.getUpdatedValue=function(a,b){var c,d,e,f=this.arrayTo,g=[];if(f[0]instanceof Array){var h=this.arrayToIndexedInterpolated;for(e=h.length,d=0;e>d;d++)g[d]=b(h[d],a);return c=this.arrayToString(g)}var i=[];for(e=f.length,d=0;e>d;d++){var j=this.arrayFrom[d],k=f[d];i.push(j+(k-j)*a)}return c=this.arrayToString(i)},b.exports=c},{}],4:[function(a,b){"use strict";var c={Linear:function(a,b,c){return(b-a)*c+a},Bernstein:function(a,b){var d=c.Factorial;return d(a)/d(b)/d(a-b)},Factorial:function(){var a=[1];return function(b){var c,d=1;if(a[b])return a[b];for(c=b;c>1;c--)d*=c;return a[b]=d,a[b]}}(),CatmullRom:function(a,b,c,d,e){var f=.5*(c-a),g=.5*(d-b),h=e*e,i=e*h;return(2*b-2*c+f+g)*i+(-3*b+3*c-2*f-g)*h+f*e+b}};b.exports={Linear:function(a,b){var d=a.length-1,e=d*b,f=Math.floor(e),g=c.Linear;return 0>b?g(a[0],a[1],e):b>1?g(a[d],a[d-1],d-e):g(a[f],a[f+1>d?d:f+1],e-f)},Bezier:function(a,b){var d,e=0,f=a.length-1,g=Math.pow,h=c.Bernstein;for(d=0;f>=d;d++)e+=g(1-b,f-d)*g(b,d)*a[d]*h(f,d);return e},CatmullRom:function(a,b){var d=a.length-1,e=d*b,f=Math.floor(e),g=c.CatmullRom;return a[0]===a[d]?(0>b&&(f=Math.floor(e=d*(1+b))),g(a[(f-1+d)%d],a[f],a[(f+1)%d],a[(f+2)%d],e-f)):0>b?a[0]-(g(a[0],a[0],a[1],a[1],-e)-a[0]):b>1?a[d]-(g(a[d],a[d],a[d-1],a[d-1],e-d)-a[d]):g(a[f?f-1:0],a[f],a[f+1>d?d:f+1],a[f+2>d?d:f+2],e-f)}}},{}],5:[function(a,b){"use strict";var c=function(a){this.tweens=a||[],this.window=!1};c.prototype.window=null,c.prototype.tweens=null,c.prototype.add=function(a){return this.tweens.push(a),this},c.prototype.remove=function(a){var b=this.tweens.indexOf(a);return-1!==b&&this.tweens.splice(b,1),this},c.prototype.update=function(a){if(0===this.tweens.length)return!1;var b=0;if(void 0===a){var c=this.window||c;a="undefined"!=typeof c&&"undefined"!=typeof c.performance&&"undefined"!=typeof c.performance.now?c.performance.now():Date.now()}for(;b<this.tweens.length;){var d=this.tweens[b],e=d.update(a);if(d.remove||!e){if(this.tweens.splice(b,1),!d.remove&&d.chained){var f=d.chained.length;for(b=0;f>b;b++){var g=d.chained[b];this.add(g),g.start(a)}}}else b++}return!0},c.prototype.start=function(a){for(var b=this.tweens.length-1;b>=0;b--)this.tweens[b].start(a);return this},b.exports=c},{}],6:[function(a,b){"use strict";var c=a("./easing.js"),d=a("./interpolation.js"),e=function(a,b){b=b||{},this._object=a,this._valuesStart={},this._valuesStartRepeat={},this._startTime=null,this._onStartCallbackFired=!1,this._onCompleteCallbackFired=!1,this.remove=!1,this._isPlaying=!1,this._reversed=!1,this.filters=b.filters||{},this.duration=b.duration||1e3,this.repeat=b.repeat||0,this.repeatDelay=b.repeatDelay||0,this.delay=b.delay||0,this.from=b.from||!1,this.to=b.to||{},this.yoyo=b.yoyo||!1,this.easing=b.easing||c.Linear.None,this.interpolation=b.interpolation||d.Linear,this.chained=b.chained||[],this.onStart=b.onStart||!1,this.onUpdate=b.onUpdate||!1,this.onComplete=b.onComplete||!1,this.onRepeat=b.onRepeat||!1,this.onYoYo=b.onYoYo||!1,this.window=!1};e.prototype.start=function(a){this._isPlaying=!0;var b;for(var c in this._object)this.from&&"undefined"!=typeof this.from[c]&&(this._object[c]=this.from[c]);if(this._onStartCallbackFired=!1,this._onCompleteCallbackFired=!1,"undefined"!=typeof a)this._startTime=a;else{var d=this.window||d;this._startTime="undefined"!=typeof d&&"undefined"!=typeof d.performance&&"undefined"!=typeof d.performance.now?d.performance.now():Date.now()}this._startTime+=this.delay;for(b in this.to){var e=this.to[b],f=this.filters[b];if(e instanceof Array){if(0===e.length)continue;e=[this._object[b]].concat(e)}f&&f.start(this._object[b],e),this.to[b]=e,this._valuesStart[b]=this._object[b],this._valuesStartRepeat[b]=this._valuesStart[b]||0}return this},e.prototype.update=function(a){if(!this._isPlaying)return!0;var b;if(a<this._startTime)return!0;this._onStartCallbackFired===!1&&(this.onStart&&this.onStart(this._object,this,0,0),this._onStartCallbackFired=!0);var c=(a-this._startTime)/this.duration;c=c>1?1:c;var d=this.easing(c);for(b in this.to){var e,f=this._valuesStart[b]||0,g=this.to[b],h="undefined"!=typeof this.filters[b]?this.filters[b]:!1;"number"==typeof g?e=f+(g-f)*d:h?e=h.getUpdatedValue(d,this.interpolation):g instanceof Array&&(e=this.interpolation(g,d)),"undefined"!=typeof e&&(this._object[b]=e)}if(this.onUpdate&&this.onUpdate(this._object,this,d,c),1==c){if(this.repeat>0){isFinite(this.repeat)&&this.repeat--;for(b in this._valuesStartRepeat){if(this.yoyo){var i=this._valuesStartRepeat[b];this._valuesStartRepeat[b]=this.to[b],this.to[b]=i,this._reversed=!this._reversed,this.onYoYo&&this.onYoYo(this._object,this,1,1)}this._valuesStart[b]=this._valuesStartRepeat[b],this.filters[b]&&this.filters[b].start(this._valuesStart[b],this.to[b])}return this._startTime=a+this.repeatDelay,this.onRepeat&&this.onRepeat(this._object,this,1,1),!0}return this._onCompleteCallbackFired===!1&&(this.onComplete&&this.onComplete(this._object,this,1,1),this._onCompleteCallbackFired=!0),!1}return!0},e.prototype.getDuration=function(){var a=0;return this.repeat&&(a=this.repeatDelay),this.delay+(a+this.duration)*(this.repeat||1)},b.exports=e},{"./easing.js":2,"./interpolation.js":4}]},{},[1])(1)});