es6-tween
Advanced tools
Comparing version 3.8.15 to 3.8.16
@@ -1,3 +0,3 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.TWEEN={})}(this,function(t){"use strict";var e,n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t){!function(e,n){t.exports?t.exports=n():e.InterTween=n()}("undefined"!=typeof window?window:n,function(){function t(t){var e=parseFloat(t);return"number"!=typeof e||isNaN(e)?t:e}function e(t,e){var n,r,i;3===e.length&&(e=(n=e[0])+n+(r=e[1])+r+(i=e[2])+i);var o=parseInt(e,16);return n=o>>16&m,r=o>>8&m,i=o&m,"rgb("+n+","+r+","+i+")"}function n(t){return"string"==typeof t?t.replace(v,"").replace(_,","):t}function r(t,e){if("number"==typeof e)return e;var n=x[e.substr(0,2)],r=e.substr(2);if(1===n){var i=e[0]+r;return t+parseFloat(i)}return 2===n?t*+r:3===n?t/+r:4===n?t*(+r/100):e}function i(e){var n=M(e);return"string"==typeof n?n.match(d).map(t):e}function o(t,e,n,o){if(n=null!==n&&void 0!==n?n:1e4,!d.test(e))return e;var u=i(t),s=i(e),a=f(u,s,n,o);if(a)return a;a=null;for(var p=null,h=null,y=[],v=0,_=s.length;v<_;v++){var m=s[v],g=u[v];y[v]="string"==typeof m&&1===m.indexOf("=")?m:null,c.test(m)?(p=v+2,h=v+11):l.test(m)&&(p=v,h=v+9),s[v]=g===m?null:null!==y[v]?r(g,m):m}return function(t,e,i){i||(i=o),e=void 0!==e?e:t;var a="";for(v=0;v<_;v++){var f=u[v],l=s[v],c=y[v],d="function"==typeof i?i(t):t;a+="number"==typeof l?null!==p&&v>p&&v<h?f+(l-f)*d|0:((f+(l-f)*d)*n|0)/n:f,1===e&&null!==c&&(u[v]=l,s[v]=r(l,c))}return a}}function u(t,e,n,r){for(var i=[],u=0,s=t.length;u<s;u++){var f=t[u];i[u]=g(f)?a(f,e,n,r&&r[u]||r):"object"==typeof f?p(f,e,n,r&&r[u]||r):"string"==typeof f?o(f,e,n,r&&r[u]||r):f}return function(n,o,u){o=void 0!==o?o:n,u||(u=r);for(var s=0,a=i.length;s<a;s++){var f=f="function"==typeof u?u:u&&"function"==typeof u[s]?u[s]:null,p=f(n);t[s]="function"==typeof i[s]?i[s](f?n:p,o,u):"number"==typeof i[s]?i[s]+(e-i[s])*p:i[s]}return t}}function s(t,e,n,r){for(var i=[],o=0,u=e.length;o<u;o++){var s=e[o];i[o]=h(0===o?t:e[o-1],s,n,r&&r[o]||r)}var a=e[e.length-1];i.push(h(a,a,n,r&&r[e.length-1]||r));var f=i.length-1;return function(t){var e=t*f,n=Math.max(0,Math.floor(e)),r=e-n,o=i[n];return"function"==typeof o?o(r):o}}function a(t,e,n,i){n=null!==n&&void 0!==n?n:1e4,w(e),w(t);for(var f=t.slice(),h=[],l=Math.min(t.length,e.length),c=0;c<l;c++){var d=f[c],y=e[c];void 0!==d&&null!==d?(h[c]="string"==typeof y&&1===y.indexOf("=")?y:null,f[c]=y.nodeType||y.update?y.update:d===y?null:g(y)?g(d)&&y.length===d.length?a(d,y,n,i&&i[c]||i):s(d,y,n,i&&i[c]||i):g(d)?u(d,y,n,i&&i[c]||i):"object"==typeof d?p(d,y,n,i&&i[c]||i):"string"==typeof d?o(d,y,n,i&&i[c]||i):void 0!==d?d:y,e[c]=null!==h[c]?r(d,y):y):("function"==typeof y||y&&y.update)&&(f[c]=y)}return function(o,u,s){s||(s=i);for(var a=0;a<l;a++){var p=f[a],c=e[a],d=h[a];if(null!==p&&void 0!==p){var y=y="function"==typeof s?s:s&&"function"==typeof s[a]?s[a]:null,v=y?y(o):o;t[a]="number"==typeof p?((p+(c-p)*v)*n|0)/n:"function"==typeof p?p(y?o:v,u,y):p.update?p.update(v,u,y):c&&c.update?c.update(v,u,y):c,d&&1===u&&(f[a]=c,e[a]=r(f[a],d))}}return 1===u?e:t}}function f(t,e,n,i){if(n=null!==n&&void 0!==n?n:1e4,2===e.length&&2===t.length&&-1!==I.indexOf(e[1])){var o=+t[0],u=+e[0],s=e[1],a="string"==typeof e[0]&&1===e[0].indexOf("=")?e[0]:null;return a&&(u=r(o,u)),o===u&&e[0]===s?e:function(t,e,f){f||(f=i);var p="function"==typeof f?f(t):t,h=((o+(u-o)*p)*n|0)/n+s;return a&&1===e&&(u=r(o=u,a)),h}}return!1}function p(t,e,n,i){n=null!==n&&void 0!==n?n:1e4;var f,h={},l={};w(e),w(t),w(i);for(var c in e){var d=t[c],y=e[c];if(void 0!==d&&null!==d){var v=P(t,c);h[c]="string"==typeof y&&1===y.indexOf("=")?y:null,v&&!1===v.writable&&!v.set&&(f||(f={}),f[c]=!0),l[c]=y.nodeType?y:y.update?y:d===y?null:g(y)?g(d)&&y.length===d.length?a(d,y,n,i&&i[c]||i):s(d,y,n,i&&i[c]||i):g(d)?u(d,y,n,i&&i[c]||i):"object"==typeof d?p(d,y,n,i&&i[c]||i):"string"==typeof d?o(d,y,n,i&&i[c]||i):void 0!==d?d:y,e[c]=null!==h[c]?r(d,y):y}else("function"==typeof y||y&&y.update)&&(l[c]=y)}return function(o,u,s){s||(s=i),u=void 0!==u?u:o;for(var a in l){var p=l[a],c=e[a],d=h[a],y="function"==typeof s?s:s&&"function"==typeof s[a]?s[a]:null,v=y?y(o):o,_="number"==typeof p?((p+(c-p)*v)*n|0)/n:"function"==typeof p?p(y?o:v,u,y):p&&p.update?p.update(v,u,y):c&&c.update?c.update(v,u,y):c;f&&f[a]||(t[a]=_),1===u&&d&&(l[a]=c,e[a]=r(l[a],d))}return 1===u?e:t}}function h(t,e,n,i){w(i),n=null!==n&&void 0!==n?n:1e4;var f="string"==typeof e&&"number"==typeof t&&1===e.indexOf("=")?e:null;return f&&(e=r(t,f)),e.nodeType?e:t.nodeType?t:g(e)?g(t)&&t.length===e.length?a(t,e,n,i):s(t,e,n,i):g(t)?u(t,e,n,i):"object"==typeof e?p(t,e,n,i):"string"==typeof e?o(t,e,n,i):"function"==typeof e?e:function(o,u,s){u=void 0!==u?u:o,s||(s=i);var a="function"==typeof s?s(o):o,p="number"==typeof e?((t+(e-t)*a)*n|0)/n:t;return f&&1===u&&(e=r(t+=e,f)),p}}var l=/rgb/g,c=/argb/g,d=/\s+|([A-Za-z?().,{}:""[\]#\%]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,y=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,v=/\n|\r|\t/g,_=/, | ,| , /g,m=255,g=Array.isArray||function(t){return t instanceof Array},b=/([.\[])/g,T=/\]/g,O=function(t,e){var n=t[e],r=e.replace(T,"").split(b),i=r.length-1,o=Array.isArray(t),u="object"==typeof t&&!o;return u?(t[e]=null,delete t[e]):o&&t.splice(e,1),r.reduce(function(t,e,s){o&&"."!==e&&"["!==e&&(e*=1);var a="["===r[s+1];if("."===e||"["===e)return"."===e?(u=!0,o=!1):"["===e&&(u=!1,o=!0),t;if(void 0===t[e]){if(o||u)return t[e]=s===i?n:o||a?[]:u?{}:null,u=o=!1,t[e]}else if(void 0!==t[e])return s===i&&(t[e]=n),t[e];return t},t)},w=function(t){if("object"==typeof t&&t)for(var e in t)if(-1!==e.indexOf(".")||-1!==e.indexOf("["))O(t,e);else if("object"==typeof t[e]&&t[e]){var n=t[e];for(var r in n)if(-1!==r.indexOf(".")||-1!==r.indexOf("["))O(n,r);else if("object"==typeof n[r]&&n[r]){var i=n[r];for(var o in i)-1===o.indexOf(".")&&-1===o.indexOf("[")||O(i,o)}}return t},x={"+=":1,"-=":1,"*=":2,"/=":3,"%=":4},M=function(t){return"string"!=typeof t?t:n(t).replace(y,e)},I=["px","pt","pc","deg","rad","turn","em","ex","cm","mm","dm","inch","in","rem","vw","vh","vmin","vmax","%"],j=Object.getOwnPropertyDescriptor,P=j||function(){};return h})}),i=Object.create||function(t){return Object.assign({},t||{})},o="undefined"!=typeof window?window:"undefined"!=typeof global?global:this,u=o.requestAnimationFrame||function(t){return o.setTimeout(t,16)},s=o.cancelAnimationFrame||function(t){return o.clearTimeout(t)},a=function(){if("undefined"!=typeof process&&void 0!==process.hrtime)return function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6};if(void 0!==o.performance&&void 0!==o.performance.now)return o.performance.now.bind(o.performance);var t=o.performance&&o.performance.timing&&o.performance.timing.navigationStart?o.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}(),f=[],p=!1,h=!1,l=u,c=s,d=a(),y=0,v=0,_=function(t){f.push(t),h&&!p&&(d=a(),e=l(b),p=!0)},m=function(t){for(var e=0;e<f.length;e++)if(t===f[e])return f[e];return null},g=function(t){var e=f.indexOf(t);-1!==e&&f.splice(e,1)},b=function(t,n){if(t=void 0!==t?t:a(),(y=t-d)>150&&(v=y-50/3),d=t,h&&p&&(e=l(b)),0===f.length)return c(e),p=!1,!1;for(var r,i=0;i<f.length;)r=f[i],v&&(r._startTime+=v),r.update(t,n),i++;return v&&(v=0),!0},T={},O={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-O.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*O.Bounce.In(2*t):.5*O.Bounce.Out(2*t-1)+.5}}},w=function(){this.totalTime=0,this.labels=[],this.offsets=[]};w.prototype.parseLabel=function(t,e){var n=this,r=n.offsets,i=n.labels,o=i.indexOf(t);if("string"==typeof t&&-1!==t.indexOf("=")&&!e&&-1===o){var u=t.substr(t.indexOf("=")-1,2),s=t.split(u);e=2===s.length?u+s[1]:null,t=s[0],o=i.indexOf(t)}if(-1!==o&&t){var a=r[o]||0;if("number"==typeof e)a=e;else if("string"==typeof e&&-1!==e.indexOf("=")){var f=e.charAt(0);e=Number(e.substr(2)),"+"===f||"-"===f?a+=parseFloat(f+e):"*"===f?a*=e:"/"===f?a/=e:"%"===f&&(a*=e/100)}return a}return"number"==typeof e?e:0},w.prototype.addLabel=function(t,e){return this.labels.push(t),this.offsets.push(this.parseLabel(t,e)),this},w.prototype.setLabel=function(t,e){var n=this.labels.indexOf(t);return-1!==n&&this.offsets.splice(n,1,this.parseLabel(t,e)),this},w.prototype.eraseLabel=function(t){var e=this.labels.indexOf(t);return-1!==e&&(this.labels.splice(e,1),this.offsets.splice(e,1)),this};var x=function(){this._events={}};x.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e),this},x.prototype.once=function(t,e){var n=this;this._events[t]||(this._events[t]=[]);var r=this._events,i=r[t].length;return this._events[t].push(function(){for(var o=[],u=arguments.length;u--;)o[u]=arguments[u];e.apply(n,o),r[t].splice(i,1)}),this},x.prototype.off=function(t,e){var n=this._events;return void 0!==t&&n[t]?(e?this._events[t]=this._events[t].filter(function(t){return t!==e}):this._events[t].length=0,this):this},x.prototype.emit=function(t,e,n,r,i){var o=this._events[t];if(!o||!o.length)return this;for(var u=0,s=o.length;u<s;u++)o[u](e,n,r,i);return this};var M={},I=function(t,e){if(!t||!t.nodeType)return e;var n=t.queueID||"q_"+Date.now();return t.queueID||(t.queueID=n),M[n]?(e&&(M[n]=e),M[n]):(M[n]=e,M[n])},j=function(t,e){return e?t?t===window||t===document?[t]:"string"==typeof t?!!document.querySelectorAll&&document.querySelectorAll(t):Array.isArray(t)?t:t.nodeType?[t]:[]:null:t?t===window||t===document?t:"string"==typeof t?!!document.querySelector&&document.querySelector(t):Array.isArray(t)?t[0]:t.nodeType?t:null:null};Object.create=i;var P=0,F=O.Linear.None,A=function(t){function e(e,n){return t.call(this),this.id=P++,!e||"object"!=typeof e||n||e.nodeType?e&&(e.nodeType||e.length||"string"==typeof e)&&(e=this.node=j(e),n=this.object=I(e,n)):(n=this.object=e,e=null),this._valuesEnd=null,this._valuesFunc=null,this._duration=1e3,this._easingFunction=F,this._easingReverse=F,this._startTime=0,this._delayTime=0,this._repeat=0,this._r=0,this._isPlaying=!1,this._yoyo=!1,this._reversed=!1,this._onStartCallbackFired=!1,this._pausedTime=null,this._isFinite=!0,this._elapsed=0,this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fromTo=function(t,n,r,i){void 0===i&&(i={}),i.quickRender=i.quickRender?i.quickRender:!r;var o=new e(t,n).to(r,i);return i.quickRender&&(o.render().update(o._startTime),o._rendered=!1,o._onStartCallbackFired=!1),o},e.to=function(t,n,r){return e.fromTo(t,null,n,r)},e.from=function(t,n,r){return e.fromTo(t,n,null,r)},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isStarted=function(){return this._onStartCallbackFired},e.prototype.reverse=function(){var t=this._reversed;return this._reversed=!t,this},e.prototype.reversed=function(){return this._reversed},e.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,g(this),this._pausedTime=a(),this.emit("pause",this.object)):this},e.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=a()-this._pausedTime,_(this),this._pausedTime=a(),this.emit("play",this.object))},e.prototype.restart=function(t){return this._repeat=this._r,this._startTime=a()+(t?0:this._delayTime),this._isPlaying||_(this),this.emit("restart",this.object)},e.prototype.seek=function(t,e){return this._startTime=a()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this.object),e?this:this.pause()},e.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},e.prototype.to=function(t,e,n){var r=this;if(void 0===e&&(e=1e3),this._valuesEnd=t,"number"==typeof e||"function"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var i in e)if("function"==typeof r[i]){var o=Array.isArray(e[i])?e[i]:[e[i]],u=o[0];void 0===u&&(u=null);var s=o[1];void 0===s&&(s=null);var a=o[2];void 0===a&&(a=null);var f=o[3];void 0===f&&(f=null),r[i](u,s,a,f)}return this},e.prototype.render=function(){var t=this;if(this._rendered)return this;var e=this,n=e._valuesEnd,i=e.object,o=e.Renderer,u=e.node,s=e.InitialValues,a=e._easingFunction;u&&s&&(i?n||(n=this._valuesEnd=s(u,i)):i=this.object=I(u,s(u,n)));for(var f in n){var p=i&&i[f],h=n[f];if(T[f]){var l=T[f].prototype.update?new T[f](t,p,h,f,i):T[f](t,p,h,f,i);l&&(n[f]=l)}else;}return this._valuesFunc=r(i,n,null,a),o&&this.node&&(this.__render=new o(this,i,n)),this},e.prototype.start=function(t){return this._startTime=void 0!==t?t:a(),this._startTime+=this._delayTime,this._onStartCallbackFired=!1,this._rendered=!1,this._isPlaying=!0,_(this),this},e.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object,r=t._startTime,i=t._duration;return e?(this.update(r+i),this._isPlaying=!1,g(this),this.emit("stop",n)):this},e.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this},e.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this._isFinite=isFinite(t),this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime="function"==typeof t?t(this._repeatDelayTime):t,this},e.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},e.prototype.yoyo=function(t,e){return this._yoyo="function"==typeof t?t(this._yoyo):null===t?this._yoyo:t,this._easingReverse=e||this._easingFunction,this},e.prototype.easing=function(t){return this._easingFunction=t,this},e.prototype.reassignValues=function(t){var e=this,n=e._valuesFunc,r=e.object,i=e._delayTime;this._isPlaying=!0,this._startTime=void 0!==t?t:a(),this._startTime+=i,_(this);var o=n(0);for(var u in o){var s=o[u];r[u]=s}return this},e.prototype.update=function(t,e){var n,r,i=this,o=i._onStartCallbackFired,u=i._easingFunction,s=i._easingReverse,f=i._repeat,p=i._repeatDelayTime,h=i._reverseDelayTime,l=i._yoyo,c=i._reversed,d=i._startTime,y=i._duration,v=i._valuesFunc,_=i.object,m=i._isFinite,b=i._isPlaying,T=i.__render;return t=void 0!==t?t:a(),!b||t<d||(o||(this._rendered||(this.render(),this._rendered=!0,v=this._valuesFunc),this.emit("start",_),this._onStartCallbackFired=!0),n=(t-d)/y,n=n>1?1:n,n=c?1-n:n,r=c?s:u,!_||(v(n,n,r),T&&T.update(_,n),this.emit("update",_,n),!(1===n||c&&0===n)||(f?(m&&this._repeat--,l&&(this._reversed=!c),this.emit(l&&!c?"reverse":"repeat",_),this._startTime=!c&&p?t+p:c&&h?t+h:t,!0):(e||(this._isPlaying=!1,g(this),P--),this.emit("complete",_),this._repeat=this._r,!1))))},e}(x),L=function(t){var e,n,r;for(r=t.length;r;r-=1)e=Math.floor(Math.random()*r),n=t[r-1],t[r-1]=t[e],t[e]=n;return t},q=0,D=function(t){function e(e){return t.call(this),this._duration=0,this._startTime=a(),this._tweens=[],this._elapsed=0,this._id=q++,this._defaultParams=e,this.position=new w,this.position.addLabel("afterLast",this._duration),this.position.addLabel("afterInit",this._startTime),this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.mapTotal=function(t){return t.call(this,this._tweens),this},e.prototype.timingOrder=function(t){var e=t(this._tweens.map(function(t){return t._startTime}));return this._tweens.map(function(t,n){t._startTime=e[n]}),this},e.prototype.getTiming=function(t,e,n,r){if(void 0===r&&(r=0),"reverse"===t){var i=n.stagger,o=(i||0)*(e.length-1);return e.map(function(t,e){return o-(i||0)*e+r})}if("async"===t)return e.map(function(t){return r});if("sequence"===t||"delayed"===t){var u=n.stagger;return u||(u=(n.duration||1e3)/(e.length-1)),e.map(function(t,e){return u*e+r})}if("oneByOne"===t)return e.map(function(t){return n.duration});if("shuffle"===t){var s=n.stagger;return L(e.map(function(t,e){return(s||0)*e+r}))}var a=n.stagger;return e.map(function(t,e){return(a||0)*e+r})},e.prototype.fromTo=function(e,n,r,i){var o=this;if((e=j(e,!0))&&e.length){this._defaultParams&&(i=Object.assign({},this._defaultParams,i));for(var u=i.label,s="number"==typeof u?u:this.position.parseLabel(void 0!==u?u:"afterLast",null),a=this.getTiming(i.mode,e,i,s),f=0,p=void 0,h=e.length;f<h;f++)p=e[f],o.add(t.fromTo(p,"function"==typeof n?n(f,e.length):Object.assign({},n),"function"==typeof r?r(f,e.length):r,"function"==typeof i?i(f,e.length):i),a[f])}return this.start()},e.prototype.from=function(t,e,n){return this.fromTo(t,e,null,n)},e.prototype.to=function(t,e,n){return this.fromTo(t,null,e,n)},e.prototype.addLabel=function(t,e){return this.position.addLabel(t,e),this},e.prototype.map=function(t){for(var e=this,n=0,r=this._tweens.length;n<r;n++){var i=e._tweens[n];t(i,n),e._duration=Math.max(e._duration,i._duration+i._startTime)}return this},e.prototype.add=function(e,n){var r=this;if(Array.isArray(e))return e.map(function(t){r.add(t,n)}),this;"object"!=typeof e||e instanceof t||(e=new t(e.from).to(e.to,e));var i=this,o=i._defaultParams,u=i._duration;if(o)for(var s in o)"function"==typeof e[s]&&e[s](o[s]);var a="number"==typeof n?n:this.position.parseLabel(void 0!==n?n:"afterLast",null);return e._startTime=Math.max(this._startTime,e._delayTime,a),e._delayTime=a,e._isPlaying=!0,this._duration=Math.max(u,e._startTime+e._delayTime+e._duration),this._tweens.push(e),this.position.setLabel("afterLast",this._duration),this},e.prototype.restart=function(){return this._startTime+=a(),_(this),this.emit("restart")},e.prototype.easing=function(t){return this.map(function(e){return e.easing(t)})},e.prototype.interpolation=function(t){return this.map(function(e){return e.interpolation(t)})},e.prototype.update=function(t){var e=this,n=e._tweens,r=e._duration,i=e._repeatDelayTime,o=e._reverseDelayTime,u=e._startTime,s=e._reversed,a=e._yoyo,f=e._repeat,p=e._isFinite;if(!e._isPlaying||t<u)return!0;var h=(t-u)/r;h=h>1?1:h,h=s?1-h:h;for(var l=t-u,c=s?r-l:l,d=0;d<n.length;)n[d].update(c),d++;if(this.emit("update",h,l),1===h||s&&0===h){if(f){for(p&&this._repeat--,this.emit(s?"reverse":"repeat"),a&&(this._reversed=!s,this.timingOrder(function(t){return t.reverse()})),this._startTime=!s&&i?t+i:s&&o?t+o:t,d=0;d<n.length;)n[d].reassignValues(t),d++;return!0}return this.emit("complete"),this._repeat=this._r,g(this),this._isPlaying=!1,!1}return!0},e.prototype.elapsed=function(t){return void 0!==t?this.update(t*this._duration):this._elapsed},e}(A);t.Plugins=T,t.Interpolator=r,t.onTick=function(t){return f.push({update:t})},t.has=function(t){return null!==m(t)},t.get=m,t.getAll=function(){return f},t.removeAll=function(){f.length=0},t.remove=g,t.add=_,t.now=a,t.update=b,t.autoPlay=function(t){h=t},t.isRunning=function(){return p},t.Tween=A,t.Easing=O,t.Timeline=D,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.TWEEN={})}(this,function(t){"use strict";var e,n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t){!function(e,n){t.exports?t.exports=n():e.InterTween=n()}("undefined"!=typeof window?window:n,function(){function t(t){var e=parseFloat(t);return"number"!=typeof e||isNaN(e)?t:e}function e(t,e){var n,r,i;3===e.length&&(e=(n=e[0])+n+(r=e[1])+r+(i=e[2])+i);var o=parseInt(e,16);return n=o>>16&m,r=o>>8&m,i=o&m,"rgb("+n+","+r+","+i+")"}function n(t){return"string"==typeof t?t.replace(v,"").replace(_,","):t}function r(t,e){if("number"==typeof e)return e;var n=x[e.substr(0,2)],r=e.substr(2);if(1===n){var i=e[0]+r;return t+parseFloat(i)}return 2===n?t*+r:3===n?t/+r:4===n?t*(+r/100):e}function i(e){var n=M(e);return"string"==typeof n?n.match(d).map(t):e}function o(t,e,n,o){if(n=null!==n&&void 0!==n?n:1e4,!d.test(e))return e;var u=i(t),s=i(e),a=f(u,s,n,o);if(a)return a;a=null;for(var p=null,h=null,y=[],v=0,_=s.length;v<_;v++){var m=s[v],g=u[v];y[v]="string"==typeof m&&1===m.indexOf("=")?m:null,c.test(m)?(p=v+2,h=v+11):l.test(m)&&(p=v,h=v+9),s[v]=g===m?null:null!==y[v]?r(g,m):m}return function(t,e,i){i||(i=o),e=void 0!==e?e:t;var a="";for(v=0;v<_;v++){var f=u[v],l=s[v],c=y[v],d="function"==typeof i?i(t):t;a+="number"==typeof l?null!==p&&v>p&&v<h?f+(l-f)*d|0:((f+(l-f)*d)*n|0)/n:f,1===e&&null!==c&&(u[v]=l,s[v]=r(l,c))}return a}}function u(t,e,n,r){for(var i=[],u=0,s=t.length;u<s;u++){var f=t[u];i[u]=g(f)?a(f,e,n,r&&r[u]||r):"object"==typeof f?p(f,e,n,r&&r[u]||r):"string"==typeof f?o(f,e,n,r&&r[u]||r):f}return function(n,o,u){o=void 0!==o?o:n,u||(u=r);for(var s=0,a=i.length;s<a;s++){var f=f="function"==typeof u?u:u&&"function"==typeof u[s]?u[s]:null,p=f(n);t[s]="function"==typeof i[s]?i[s](f?n:p,o,u):"number"==typeof i[s]?i[s]+(e-i[s])*p:i[s]}return t}}function s(t,e,n,r){for(var i=[],o=0,u=e.length;o<u;o++){var s=e[o];i[o]=h(0===o?t:e[o-1],s,n,r&&r[o]||r)}var a=e[e.length-1];i.push(h(a,a,n,r&&r[e.length-1]||r));var f=i.length-1;return function(t){var e=t*f,n=Math.max(0,Math.floor(e)),r=e-n,o=i[n];return"function"==typeof o?o(r):o}}function a(t,e,n,i){n=null!==n&&void 0!==n?n:1e4,w(e),w(t);for(var f=t.slice(),h=[],l=Math.min(t.length,e.length),c=0;c<l;c++){var d=f[c],y=e[c];void 0!==d&&null!==d?(h[c]="string"==typeof y&&1===y.indexOf("=")?y:null,f[c]=y.nodeType||y.update?y.update:d===y?null:g(y)?g(d)&&y.length===d.length?a(d,y,n,i&&i[c]||i):s(d,y,n,i&&i[c]||i):g(d)?u(d,y,n,i&&i[c]||i):"object"==typeof d?p(d,y,n,i&&i[c]||i):"string"==typeof d?o(d,y,n,i&&i[c]||i):void 0!==d?d:y,e[c]=null!==h[c]?r(d,y):y):("function"==typeof y||y&&y.update)&&(f[c]=y)}return function(o,u,s){s||(s=i);for(var a=0;a<l;a++){var p=f[a],c=e[a],d=h[a];if(null!==p&&void 0!==p){var y=y="function"==typeof s?s:s&&"function"==typeof s[a]?s[a]:null,v=y?y(o):o;t[a]="number"==typeof p?((p+(c-p)*v)*n|0)/n:"function"==typeof p?p(y?o:v,u,y):p.update?p.update(v,u,y):c&&c.update?c.update(v,u,y):c,d&&1===u&&(f[a]=c,e[a]=r(f[a],d))}}return 1===u?e:t}}function f(t,e,n,i){if(n=null!==n&&void 0!==n?n:1e4,2===e.length&&2===t.length&&-1!==I.indexOf(e[1])){var o=+t[0],u=+e[0],s=e[1],a="string"==typeof e[0]&&1===e[0].indexOf("=")?e[0]:null;return a&&(u=r(o,u)),o===u&&e[0]===s?e:function(t,e,f){f||(f=i);var p="function"==typeof f?f(t):t,h=((o+(u-o)*p)*n|0)/n+s;return a&&1===e&&(u=r(o=u,a)),h}}return!1}function p(t,e,n,i){n=null!==n&&void 0!==n?n:1e4;var f,h={},l={};w(e),w(t),w(i);for(var c in e){var d=t[c],y=e[c];if(void 0!==d&&null!==d){var v=P(t,c);h[c]="string"==typeof y&&1===y.indexOf("=")?y:null,v&&!1===v.writable&&!v.set&&(f||(f={}),f[c]=!0),l[c]=y.nodeType?y:y.update?y:d===y?null:g(y)?g(d)&&y.length===d.length?a(d,y,n,i&&i[c]||i):s(d,y,n,i&&i[c]||i):g(d)?u(d,y,n,i&&i[c]||i):"object"==typeof d?p(d,y,n,i&&i[c]||i):"string"==typeof d?o(d,y,n,i&&i[c]||i):void 0!==d?d:y,e[c]=null!==h[c]?r(d,y):y}else("function"==typeof y||y&&y.update)&&(l[c]=y)}return function(o,u,s){s||(s=i),u=void 0!==u?u:o;for(var a in l){var p=l[a],c=e[a],d=h[a],y="function"==typeof s?s:s&&"function"==typeof s[a]?s[a]:null,v=y?y(o):o,_="number"==typeof p?((p+(c-p)*v)*n|0)/n:"function"==typeof p?p(y?o:v,u,y):p&&p.update?p.update(v,u,y):c&&c.update?c.update(v,u,y):c;f&&f[a]||(t[a]=_),1===u&&d&&(l[a]=c,e[a]=r(l[a],d))}return 1===u?e:t}}function h(t,e,n,i){w(i),n=null!==n&&void 0!==n?n:1e4;var f="string"==typeof e&&"number"==typeof t&&1===e.indexOf("=")?e:null;return f&&(e=r(t,f)),e.nodeType?e:t.nodeType?t:g(e)?g(t)&&t.length===e.length?a(t,e,n,i):s(t,e,n,i):g(t)?u(t,e,n,i):"object"==typeof e?p(t,e,n,i):"string"==typeof e?o(t,e,n,i):"function"==typeof e?e:function(o,u,s){u=void 0!==u?u:o,s||(s=i);var a="function"==typeof s?s(o):o,p="number"==typeof e?((t+(e-t)*a)*n|0)/n:t;return f&&1===u&&(e=r(t+=e,f)),p}}var l=/rgb/g,c=/argb/g,d=/\s+|([A-Za-z?().,{}:""[\]#\%]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,y=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,v=/\n|\r|\t/g,_=/, | ,| , /g,m=255,g=Array.isArray||function(t){return t instanceof Array},b=/([.\[])/g,T=/\]/g,O=function(t,e){var n=t[e],r=e.replace(T,"").split(b),i=r.length-1,o=Array.isArray(t),u="object"==typeof t&&!o;return u?(t[e]=null,delete t[e]):o&&t.splice(e,1),r.reduce(function(t,e,s){o&&"."!==e&&"["!==e&&(e*=1);var a="["===r[s+1];if("."===e||"["===e)return"."===e?(u=!0,o=!1):"["===e&&(u=!1,o=!0),t;if(void 0===t[e]){if(o||u)return t[e]=s===i?n:o||a?[]:u?{}:null,u=o=!1,t[e]}else if(void 0!==t[e])return s===i&&(t[e]=n),t[e];return t},t)},w=function(t){if("object"==typeof t&&t)for(var e in t)if(-1!==e.indexOf(".")||-1!==e.indexOf("["))O(t,e);else if("object"==typeof t[e]&&t[e]){var n=t[e];for(var r in n)if(-1!==r.indexOf(".")||-1!==r.indexOf("["))O(n,r);else if("object"==typeof n[r]&&n[r]){var i=n[r];for(var o in i)-1===o.indexOf(".")&&-1===o.indexOf("[")||O(i,o)}}return t},x={"+=":1,"-=":1,"*=":2,"/=":3,"%=":4},M=function(t){return"string"!=typeof t?t:n(t).replace(y,e)},I=["px","pt","pc","deg","rad","turn","em","ex","cm","mm","dm","inch","in","rem","vw","vh","vmin","vmax","%"],j=Object.getOwnPropertyDescriptor,P=j||function(){};return h})}),i=Object.create||function(t){return Object.assign({},t||{})},o="undefined"!=typeof window?window:"undefined"!=typeof global?global:this,u=o.requestAnimationFrame||function(t){return o.setTimeout(t,16)},s=o.cancelAnimationFrame||function(t){return o.clearTimeout(t)},a=function(){if("undefined"!=typeof process&&void 0!==process.hrtime)return function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6};if(void 0!==o.performance&&void 0!==o.performance.now)return o.performance.now.bind(o.performance);var t=o.performance&&o.performance.timing&&o.performance.timing.navigationStart?o.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}(),f=[],p=!1,h=!1,l=u,c=s,d=a(),y=0,v=0,_=function(t){f.push(t),h&&!p&&(d=a(),e=l(b),p=!0)},m=function(t){for(var e=0;e<f.length;e++)if(t===f[e])return f[e];return null},g=function(t){var e=f.indexOf(t);-1!==e&&f.splice(e,1)},b=function(t,n){if(t=void 0!==t?t:a(),(y=t-d)>150&&(v=y-50/3),d=t,h&&p&&(e=l(b)),0===f.length)return c(e),p=!1,!1;for(var r,i=0;i<f.length;)r=f[i],v&&(r._startTime+=v),r.update(t,n),i++;return v&&(v=0),!0},T={},O={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-O.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*O.Bounce.In(2*t):.5*O.Bounce.Out(2*t-1)+.5}}},w=function(){this.totalTime=0,this.labels=[],this.offsets=[]};w.prototype.parseLabel=function(t,e){var n=this,r=n.offsets,i=n.labels,o=i.indexOf(t);if("string"==typeof t&&-1!==t.indexOf("=")&&!e&&-1===o){var u=t.substr(t.indexOf("=")-1,2),s=t.split(u);e=2===s.length?u+s[1]:null,t=s[0],o=i.indexOf(t)}if(-1!==o&&t){var a=r[o]||0;if("number"==typeof e)a=e;else if("string"==typeof e&&-1!==e.indexOf("=")){var f=e.charAt(0);e=Number(e.substr(2)),"+"===f||"-"===f?a+=parseFloat(f+e):"*"===f?a*=e:"/"===f?a/=e:"%"===f&&(a*=e/100)}return a}return"number"==typeof e?e:0},w.prototype.addLabel=function(t,e){return this.labels.push(t),this.offsets.push(this.parseLabel(t,e)),this},w.prototype.setLabel=function(t,e){var n=this.labels.indexOf(t);return-1!==n&&this.offsets.splice(n,1,this.parseLabel(t,e)),this},w.prototype.eraseLabel=function(t){var e=this.labels.indexOf(t);return-1!==e&&(this.labels.splice(e,1),this.offsets.splice(e,1)),this};var x=function(){this._events={}};x.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e),this},x.prototype.once=function(t,e){var n=this;this._events[t]||(this._events[t]=[]);var r=this._events,i=r[t].length;return this._events[t].push(function(){for(var o=[],u=arguments.length;u--;)o[u]=arguments[u];e.apply(n,o),r[t].splice(i,1)}),this},x.prototype.off=function(t,e){var n=this._events;return void 0!==t&&n[t]?(e?this._events[t]=this._events[t].filter(function(t){return t!==e}):this._events[t].length=0,this):this},x.prototype.emit=function(t,e,n,r,i){var o=this._events[t];if(!o||!o.length)return this;for(var u=0,s=o.length;u<s;u++)o[u](e,n,r,i);return this};var M={},I=function(t,e){if(!t||!t.nodeType)return e;var n=t.queueID||"q_"+Date.now();return t.queueID||(t.queueID=n),M[n]?(e&&(M[n]=e),M[n]):(M[n]=e,M[n])},j=function(t,e){return e?t?t===window||t===document?[t]:"string"==typeof t?!!document.querySelectorAll&&document.querySelectorAll(t):Array.isArray(t)?t:t.nodeType?[t]:[]:null:t?t===window||t===document?t:"string"==typeof t?!!document.querySelector&&document.querySelector(t):Array.isArray(t)?t[0]:t.nodeType?t:null:null};Object.create=i;var P=0,F=O.Linear.None,A=function(t){function e(e,n){return t.call(this),this.id=P++,!e||"object"!=typeof e||n||e.nodeType?e&&(e.nodeType||e.length||"string"==typeof e)&&(e=this.node=j(e),n=this.object=I(e,n)):(n=this.object=e,e=null),this._valuesEnd=null,this._valuesFunc=null,this._duration=1e3,this._easingFunction=F,this._easingReverse=F,this._startTime=0,this._delayTime=0,this._repeat=0,this._r=0,this._isPlaying=!1,this._yoyo=!1,this._reversed=!1,this._onStartCallbackFired=!1,this._pausedTime=null,this._isFinite=!0,this._elapsed=0,this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fromTo=function(t,n,r,i){void 0===i&&(i={}),i.quickRender=i.quickRender?i.quickRender:!r;var o=new e(t,n).to(r,i);return i.quickRender&&(o.render().update(o._startTime),o._rendered=!1,o._onStartCallbackFired=!1),o},e.to=function(t,n,r){return e.fromTo(t,null,n,r)},e.from=function(t,n,r){return e.fromTo(t,n,null,r)},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isStarted=function(){return this._onStartCallbackFired},e.prototype.reverse=function(){var t=this._reversed;return this._reversed=!t,this},e.prototype.reversed=function(){return this._reversed},e.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,g(this),this._pausedTime=a(),this.emit("pause",this.object)):this},e.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=a()-this._pausedTime,_(this),this._pausedTime=a(),this.emit("play",this.object))},e.prototype.restart=function(t){return this._repeat=this._r,this._startTime=a()+(t?0:this._delayTime),this._isPlaying||_(this),this.emit("restart",this.object)},e.prototype.seek=function(t,e){return this._startTime=a()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this.object),e?this:this.pause()},e.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},e.prototype.to=function(t,e,n){var r=this;if(void 0===e&&(e=1e3),this._valuesEnd=t,"number"==typeof e||"function"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var i in e)if("function"==typeof r[i]){var o=Array.isArray(e[i])?e[i]:[e[i]],u=o[0];void 0===u&&(u=null);var s=o[1];void 0===s&&(s=null);var a=o[2];void 0===a&&(a=null);var f=o[3];void 0===f&&(f=null),r[i](u,s,a,f)}return this},e.prototype.render=function(){var t=this;if(this._rendered)return this;var e=this,n=e._valuesEnd,i=e.object,o=e.Renderer,u=e.node,s=e.InitialValues,a=e._easingFunction;u&&s&&(i?n||(n=this._valuesEnd=s(u,i)):i=this.object=I(u,s(u,n)));for(var f in n){var p=i&&i[f],h=n[f];if(T[f]){var l=T[f].prototype.update?new T[f](t,p,h,f,i):T[f](t,p,h,f,i);l&&(n[f]=l)}else;}return this._valuesFunc=r(i,n,null,a),o&&this.node&&(this.__render=new o(this,i,n)),this},e.prototype.start=function(t){return this._startTime=void 0!==t?t:a(),this._startTime+=this._delayTime,this._onStartCallbackFired=!1,this._rendered=!1,this._isPlaying=!0,_(this),this},e.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object,r=t._startTime,i=t._duration;return e?(this.update(r+i),this._isPlaying=!1,g(this),this.emit("stop",n)):this},e.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this},e.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this._isFinite=isFinite(t),this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime="function"==typeof t?t(this._repeatDelayTime):t,this},e.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},e.prototype.yoyo=function(t,e){return this._yoyo="function"==typeof t?t(this._yoyo):null===t?this._yoyo:t,this._easingReverse=e||this._easingFunction,this},e.prototype.easing=function(t){return this._easingFunction=t,this},e.prototype.reassignValues=function(t){var e=this,n=e._valuesFunc,r=e.object,i=e._delayTime;this._isPlaying=!0,this._startTime=void 0!==t?t:a(),this._startTime+=i,_(this);var o=n(0);for(var u in o){var s=o[u];r[u]=s}return this},e.prototype.update=function(t,e){var n,r,i=this,o=i._onStartCallbackFired,u=i._easingFunction,s=i._easingReverse,f=i._repeat,p=i._repeatDelayTime,h=i._reverseDelayTime,l=i._yoyo,c=i._reversed,d=i._startTime,y=i._duration,v=i._valuesFunc,_=i.object,m=i._isFinite,b=i._isPlaying,T=i.__render;return t=void 0!==t?t:a(),!b||t<d||(o||(this._rendered||(this.render(),this._rendered=!0,v=this._valuesFunc),this.emit("start",_),this._onStartCallbackFired=!0),n=(t-d)/y,n=n>1?1:n,n=c?1-n:n,r=c?s:u,!_||(v(n,n,r),T&&T.update(_,n),this.emit("update",_,n),!(1===n||c&&0===n)||(f?(m&&this._repeat--,l&&(this._reversed=!c),this.emit(l&&!c?"reverse":"repeat",_),this._startTime=!c&&p?t+p:c&&h?t+h:t,!0):(e||(this._isPlaying=!1,g(this),P--),this.emit("complete",_),this._repeat=this._r,!1))))},e}(x),L=function(t){var e,n,r;for(r=t.length;r;r-=1)e=Math.floor(Math.random()*r),n=t[r-1],t[r-1]=t[e],t[e]=n;return t},q=0,D=function(t){function e(e){return t.call(this),this._duration=0,this._startTime=a(),this._tweens=[],this._elapsed=0,this._id=q++,this._defaultParams=e,this.position=new w,this.position.addLabel("afterLast",this._duration),this.position.addLabel("afterInit",this._startTime),this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.mapTotal=function(t){return t.call(this,this._tweens),this},e.prototype.timingOrder=function(t){var e=t(this._tweens.map(function(t){return t._startTime}));return this._tweens.map(function(t,n){t._startTime=e[n]}),this},e.prototype.getTiming=function(t,e,n,r){if(void 0===r&&(r=0),"reverse"===t){var i=n.stagger,o=(i||0)*(e.length-1);return e.map(function(t,e){return o-(i||0)*e+r})}if("async"===t)return e.map(function(t){return r});if("sequence"===t||"delayed"===t){var u=n.stagger;return u||(u=(n.duration||1e3)/(e.length-1)),e.map(function(t,e){return u*e+r})}if("oneByOne"===t)return e.map(function(t){return n.duration});if("shuffle"===t){var s=n.stagger;return L(e.map(function(t,e){return(s||0)*e+r}))}var a=n.stagger;return e.map(function(t,e){return(a||0)*e+r})},e.prototype.fromTo=function(e,n,r,i){var o=this;if((e=j(e,!0))&&e.length){this._defaultParams&&(i=Object.assign({},this._defaultParams,i));for(var u=i.label,s="number"==typeof u?u:this.position.parseLabel(void 0!==u?u:"afterLast",null),a=this.getTiming(i.mode,e,i,s),f=0,p=void 0,h=e.length;f<h;f++)p=e[f],o.add(t.fromTo(p,"function"==typeof n?n(f,e.length):Object.assign({},n),"function"==typeof r?r(f,e.length):r,"function"==typeof i?i(f,e.length):i),a[f])}return this.start()},e.prototype.from=function(t,e,n){return this.fromTo(t,e,null,n)},e.prototype.to=function(t,e,n){return this.fromTo(t,null,e,n)},e.prototype.addLabel=function(t,e){return this.position.addLabel(t,e),this},e.prototype.map=function(t){for(var e=this,n=0,r=this._tweens.length;n<r;n++){var i=e._tweens[n];t(i,n),e._duration=Math.max(e._duration,i._duration+i._startTime)}return this},e.prototype.add=function(e,n){var r=this;if(Array.isArray(e))return e.map(function(t){r.add(t,n)}),this;"object"!=typeof e||e instanceof t||(e=new t(e.from).to(e.to,e));var i=this,o=i._defaultParams,u=i._duration;if(o)for(var s in o)"function"==typeof e[s]&&e[s](o[s]);var a="number"==typeof n?n:this.position.parseLabel(void 0!==n?n:"afterLast",null);return e._startTime=Math.max(this._startTime,e._delayTime,a),e._delayTime=a,e._isPlaying=!0,this._duration=Math.max(u,e._startTime+e._delayTime+e._duration),this._tweens.push(e),this.position.setLabel("afterLast",this._duration),this},e.prototype.restart=function(){return this._startTime+=a(),_(this),this.emit("restart")},e.prototype.easing=function(t){return this.map(function(e){return e.easing(t)})},e.prototype.interpolation=function(t){return this.map(function(e){return e.interpolation(t)})},e.prototype.update=function(t){var e=this,n=e._tweens,r=e._duration,i=e._repeatDelayTime,o=e._reverseDelayTime,u=e._startTime,s=e._reversed,a=e._yoyo,f=e._repeat,p=e._isFinite;if(!e._isPlaying||t<u)return!0;var h=(t-u)/r;h=h>1?1:h,h=s?1-h:h;for(var l=t-u,c=s?r-l:l,d=0;d<n.length;)n[d].update(c),d++;if(this.emit("update",h,l),1===h||s&&0===h){if(f){for(p&&this._repeat--,this.emit(s?"reverse":"repeat"),a&&(this._reversed=!s,this.timingOrder(function(t){return t.reverse()})),this._startTime=!s&&i?t+i:s&&o?t+o:t,d=0;d<n.length;)n[d].reassignValues(t),d++;return!0}return this.emit("complete"),this._repeat=this._r,g(this),this._isPlaying=!1,!1}return!0},e.prototype.elapsed=function(t){return void 0!==t?this.update(t*this._duration):this._elapsed},e}(A);t.Plugins=T,t.Selector=j,t.Interpolator=r,t.onTick=function(t){return f.push({update:t})},t.has=function(t){return null!==m(t)},t.get=m,t.getAll=function(){return f},t.removeAll=function(){f.length=0},t.remove=g,t.add=_,t.now=a,t.update=b,t.autoPlay=function(t){h=t},t.isRunning=function(){return p},t.Tween=A,t.Easing=O,t.Timeline=D,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=full/Tween.min.js.map | ||
//# sourceMappingURL=Tween.min.js.map |
{ | ||
"name": "es6-tween", | ||
"version": "3.8.15", | ||
"version": "3.8.16", | ||
"description": "ES6 implementation of amazing tween.js", | ||
@@ -5,0 +5,0 @@ "browser": "full/Tween.min.js", |
@@ -6,3 +6,4 @@ import Interpolator from 'intertween'; | ||
import Tween from './Tween'; | ||
import Selector from './selector'; | ||
import './shim'; | ||
export { Plugins, Interpolator, onTick, has, get, getAll, removeAll, remove, add, now, update, autoPlay, isRunning, Tween, Easing, Timeline }; | ||
export { Plugins, Selector, Interpolator, onTick, has, get, getAll, removeAll, remove, add, now, update, autoPlay, isRunning, Tween, Easing, Timeline }; |
@@ -6,3 +6,4 @@ import Interpolator from 'intertween' | ||
import Tween from './Tween' | ||
import Selector from './selector' | ||
import './shim' | ||
export { Plugins, Interpolator, onTick, has, get, getAll, removeAll, remove, add, now, update, autoPlay, isRunning, Tween, Easing, Timeline } | ||
export { Plugins, Selector, Interpolator, onTick, has, get, getAll, removeAll, remove, add, now, update, autoPlay, isRunning, Tween, Easing, Timeline } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
689056
5476