Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es6-tween

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-tween - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

78

full/Tween.js

@@ -558,3 +558,5 @@ (function (global, factory) {

if (storeID) {
if (storeID.object === object && node === storeID.tween.node) {
if (storeID.object === object &&
node === storeID.tween.node &&
tween._startTime === storeID.tween._startTime) {
remove(storeID.tween);

@@ -565,5 +567,8 @@ }

if (prop in storeID.object) {
if (tween.startTime === storeID.tween.startTime) {
if (tween._startTime === storeID.tween._startTime) {
delete storeID.object[prop];
}
else {
storeID.propNormaliseRequired = true;
}
}

@@ -575,4 +580,4 @@ }

}
Store[ID] = { tween: tween, object: object };
return Store[ID];
Store[ID] = { tween: tween, object: object, propNormaliseRequired: false };
return Store[ID].object;
};

@@ -625,3 +630,2 @@

}
var isNaNForST = function (v) { return isNaN(+v) || v[0] === '+' || v[0] === '-' || v === '' || v === ' '; };

@@ -653,3 +657,2 @@ // Decompose value, now for only `string` that required

}
// Recompose value

@@ -711,3 +714,2 @@ var DECIMAL = Math.pow(10, 4);

}
// Dot notation => Object structure converter

@@ -838,3 +840,3 @@ // example

this._isFinite = true;
this._maxListener = 5;
this._maxListener = 15;
this._prevTime = null;

@@ -894,3 +896,3 @@ return this;

Tween.prototype.setMaxListener = function (count) {
if (count === void 0) { count = 5; }
if (count === void 0) { count = 15; }
this._maxListener = count;

@@ -912,4 +914,4 @@ return this;

this[callbackId] = callback;
break;
}
break;
}

@@ -1053,3 +1055,3 @@ return this;

this._isPlaying = true;
if (updateTime < _startTime && (_startTime >= _initTime)) {
if (updateTime < _startTime && _startTime >= _initTime) {
this._startTime -= _duration;

@@ -1107,2 +1109,15 @@ this._reversed = !_reversed;

var _a = this, _valuesStart = _a._valuesStart, _valuesEnd = _a._valuesEnd, object = _a.object, Renderer = _a.Renderer, node = _a.node, InitialValues = _a.InitialValues;
if (node && node.queueID && Store[node.queueID]) {
var prevTweenByNode = Store[node.queueID];
if (prevTweenByNode.propNormaliseRequired &&
prevTweenByNode.tween !== this) {
for (var property in _valuesEnd) {
if (prevTweenByNode.tween._valuesEnd[property] !== undefined) {
delete prevTweenByNode.tween._valuesEnd[property];
}
}
prevTweenByNode.normalisedProp = true;
prevTweenByNode.propNormaliseRequired = false;
}
}
SET_NESTED(object);

@@ -1130,3 +1145,8 @@ SET_NESTED(_valuesEnd);

}
if ((typeof start === 'number' && isNaN(start)) || start === null || end === null || start === undefined || end === undefined || start === end) {
if ((typeof start === 'number' && isNaN(start)) ||
start === null ||
end === null ||
start === undefined ||
end === undefined ||
start === end) {
continue;

@@ -1174,9 +1194,9 @@ }

}
var atEnd = _isFinite ? ((_r + 1) % 2 === 1) && _yoyo : _reversed;
var atStart = _isFinite ? (_r + 1) % 2 === 1 : !_reversed;
this._reversed = false;
if (atEnd) {
this.update(_startTime + _duration);
if (_yoyo && atStart) {
this.update(_startTime);
}
else {
this.update(_startTime);
this.update(_startTime + _duration);
}

@@ -1220,3 +1240,5 @@ remove(this);

Tween.prototype.repeat = function (amount) {
this._repeat = !this._duration ? 0 : typeof amount === 'function' ? amount(this._repeat) : amount;
this._repeat = !this._duration
? 0
: typeof amount === 'function' ? amount(this._repeat) : amount;
this._r = this._repeat;

@@ -1308,2 +1330,3 @@ this._isFinite = isFinite(amount);

var property;
var propCount = 0;
if (!_duration) {

@@ -1314,6 +1337,5 @@ elapsed = 1;

time = time !== undefined ? time : now();
var delta = _startTime - _prevTime;
var delta = time - _prevTime;
if (delta > TOO_LONG_FRAME_MS) {
_startTime -= delta - FRAME_MS;
this._startTime = _startTime;
time += delta - FRAME_MS;
}

@@ -1348,5 +1370,10 @@ this._prevTime = time;

var end = _valuesEnd[property];
var value = currentEasing[property] ? currentEasing[property](elapsed) : typeof currentEasing === 'function' ? currentEasing(elapsed) : defaultEasing(elapsed);
var value = currentEasing[property]
? currentEasing[property](elapsed)
: typeof currentEasing === 'function'
? currentEasing(elapsed)
: defaultEasing(elapsed);
if (typeof end === 'number') {
object[property] = (((start + (end - start) * value) * DECIMAL) | 0) / DECIMAL;
object[property] =
(((start + (end - start) * value) * DECIMAL) | 0) / DECIMAL;
}

@@ -1365,7 +1392,12 @@ else if (Array.isArray(end) && typeof start === 'number') {

}
propCount++;
}
if (!propCount) {
remove(this);
return false;
}
if (__render) {
__render.update(object, elapsed);
}
this.emit(EVENT_UPDATE, object, elapsed);
this.emit(EVENT_UPDATE, object, elapsed, time);
if (elapsed === 1 || (_reversed && !elapsed)) {

@@ -1372,0 +1404,0 @@ if (_repeat > 0 && _duration > 0) {

@@ -1,1 +0,1 @@

!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";function e(t){if(void 0===t||"object"!=typeof t)return t;if(Array.isArray(t))return[].concat(t);if("object"==typeof t){var n={};for(var r in t)n[r]=e(t[r]);return n}return t}function n(t,e,r,i){var o=r[t],s=i[t];if("string"==typeof o&&"string"==typeof s){var u=o.match(I).map(function(t){return P(t)?t:+t}),a=s.match(I).map(function(t,e){return P(t)?t:+t});return u.unshift(j),r[t]=u,i[t]=a,!0}if("object"==typeof o&&"object"==typeof s){if(Array.isArray(o))return o.map(function(r,i){return n(i,e[t],o,s)});for(var f in s)n(f,e[t],o,s);return!0}return!1}function r(t,e,n,i,o,s){var u=n[t],a=i[t];if(void 0===a)return u;if(void 0===u||"string"==typeof u||u===a)return a;if("object"==typeof u&&"object"==typeof a){if(!u||!a)return e[t];if(u[0]===j){for(var f="",h=1,p=u.length;h<p;h++){c="string"==typeof a[h-1];f+="number"!=typeof a[h-1]?u[h]:((c?u[h]+ +a[h-1]:u[h]+(a[h-1]-u[h])*o)*x|0)/x,1===s&&(u[h]=u[h]+ +a[h-1])}return e[t]=f,f}if(Array.isArray(u))for(var h=0,p=u.length;h<p;h++)u[h]!==a[h]&&r(h,e[t],u,a,o,s);else for(var h in u)u[h]!==a[h]&&r(h,e[t],u,a,o,s)}else if("number"==typeof u){var c="string"==typeof a;e[t]=((c?u+ +a*o:u+(a-u)*o)*x|0)/x,c&&1===s&&(n[t]=e[t])}else"function"==typeof a&&(e[t]=a(o));return e[t]}var i,o="undefined"!=typeof window?window:"undefined"!=typeof global?global:this,s=o.requestAnimationFrame||function(t){return o.setTimeout(t,16)},u=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=[],h=!1,p=!1,c=s,l=u,d=function(t){var e=f.indexOf(t);if(e>-1&&f.splice(e,1),f.length>0){e=f.length-1;var n=f[e];t.prev=n,n.next=t}f.push(t),p&&!h&&(i=c(v),h=!0)},_=function(t){for(var e=0;e<f.length;e++)if(t===f[e])return f[e];return null},y=function(t){var e=f.indexOf(t);-1!==e&&f.splice(e,1)},v=function(t,e){if(t=void 0!==t?t:a(),p&&h&&(i=c(v)),!f.length)return l(i),h=!1,!1;for(var n=0;n<f.length;)f[n++].update(t,e);return!0},m={},g={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-g.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*g.Bounce.In(2*t):.5*g.Bounce.Out(2*t-1)+.5}},Stepped:{steps:function(t){return function(e){return(e*t|0)/t}}}},T={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=T.Utils.Linear;return e<0?o(t[0],t[1],r):e>1?o(t[n],t[n-1],n-r):o(t[i],t[i+1>n?n:i+1],r-i)},Bezier:function(t,e){for(var n=0,r=t.length-1,i=Math.pow,o=T.Utils.Bernstein,s=0;s<=r;s++)n+=i(1-e,r-s)*i(e,s)*t[s]*o(r,s);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=T.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(r=n*(1+e))),o(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],r-i)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):o(t[i?i-1:0],t[i],t[n<i+1?n:i+1],t[n<i+2?n:i+2],r-i)},Utils:{Linear:function(t,e,n){return"function"==typeof t?t(n):(e-t)*n+t},Bernstein:function(t,e){var n=T.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:function(){var t=[1];return function(e){var n=1;if(t[e])return t[e];for(var r=e;r>1;r--)n*=r;return t[e]=n,n}}(),CatmullRom:function(t,e,n,r,i){var o=.5*(n-t),s=.5*(r-e),u=i*i;return(2*e-2*n+o+s)*(i*u)+(-3*e+3*n-2*o-s)*u+o*i+e}}},b=function(){function t(){this.totalTime=0,this.labels=[],this.offsets=[]}return t.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 s=t.substr(t.indexOf("=")-1,2),u=t.split(s);e=2===u.length?s+u[1]:null,t=u[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},t.prototype.addLabel=function(t,e){return this.labels.push(t),this.offsets.push(this.parseLabel(t,e)),this},t.prototype.setLabel=function(t,e){var n=this.labels.indexOf(t);return-1!==n&&this.offsets.splice(n,1,this.parseLabel(t,e)),this},t.prototype.eraseLabel=function(t){var e=this.labels.indexOf(t);return-1!==e&&(this.labels.splice(e,1),this.offsets.splice(e,1)),this},t}(),w={},O=function(t,e,n){if(!t||!t.nodeType)return e;var r=t.queueID||"q_"+Date.now();t.queueID||(t.queueID=r);var i=w[r];if(i){if(i.object!==e||t!==i.tween.node){for(var o in e)o in i.object&&n.startTime===i.tween.startTime&&delete i.object[o];return e}return y(i.tween),i.object}return w[r]={tween:n,object:e},w[r]},M=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},j="STRING_PROP",I=/\s+|([A-Za-z?().,{}:""[\]#\%]+)|([-+]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,P=function(t){return isNaN(+t)||"+"===t[0]||"-"===t[0]||""===t||" "===t},x=Math.pow(10,4),A=/([.\[])/g,L=/\]/g,F=function(t,e){var n=t[e],r=e.replace(L,"").split(A),i=r.length-1,o=Array.isArray(t),s="object"==typeof t&&!o;return s?(t[e]=null,delete t[e]):o&&t.splice(e,1),r.reduce(function(t,e,u){o&&"."!==e&&"["!==e&&(e*=1);var a="["===r[u+1];if("."===e||"["===e)return"."===e?(s=!0,o=!1):"["===e&&(s=!1,o=!0),t;if(void 0===t[e]){if(o||s)return t[e]=u===i?n:o||a?[]:s?{}:null,s=o=!1,t[e]}else if(void 0!==t[e])return u===i&&(t[e]=n),t[e];return t},t)},S=function(t){if("object"==typeof t&&t)for(var e in t)if(-1!==e.indexOf(".")||-1!==e.indexOf("["))F(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("["))F(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("[")||F(i,o)}}return t},C=0,k=g.Linear.None,q=function(){function t(t,e){return this._chainedTweensCount=0,this.id=C++,!t||"object"!=typeof t||e||t.nodeType?t&&(t.nodeType||t.length||"string"==typeof t)&&(t=this.node=M(t),e=this.object=O(t,e,this)):(e=this.object=t,t=null),this._valuesEnd=null,this._valuesStart={},this._duration=1e3,this._easingFunction=k,this._easingReverse=k,this._interpolationFunction=T.Linear,this._startTime=0,this._initTime=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._maxListener=5,this._prevTime=null,this}return t.fromTo=function(e,n,r,i){void 0===i&&(i={}),i.quickRender=i.quickRender?i.quickRender:!r;var o=new t(e,n).to(r,i);return i.quickRender&&(o.render().update(o._startTime),o._rendered=!1,o._onStartCallbackFired=!1),o},t.to=function(e,n,r){return t.fromTo(e,null,n,r)},t.from=function(e,n,r){return t.fromTo(e,n,null,r)},t.prototype.setMaxListener=function(t){return void 0===t&&(t=5),this._maxListener=t,this},t.prototype.on=function(t,e){for(var n=this._maxListener,r=t+"Callback",i=0;i<n;i++){var o=r+i;this[o]||(this[o]=e);break}return this},t.prototype.once=function(t,e){return this},t.prototype.off=function(t,e){for(var n=this._maxListener,r=t+"Callback",i=0;i<n;i++){var o=r+i;this[o]===e&&(this[o]=null)}return this},t.prototype.emit=function(t,e,n,r,i){var o=this._maxListener,s=t+"Callback";if(!this[s+0])return this;for(var u=0;u<o;u++){var a=s+u;this[a]&&this[a](e,n,r,i)}return this},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isStarted=function(){return this._onStartCallbackFired},t.prototype.reverse=function(t){var e=this._reversed;return this._reversed=void 0!==t?t:!e,this},t.prototype.reversed=function(){return this._reversed},t.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,y(this),this._pausedTime=a(),this.emit("pause",this.object)):this},t.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=a()-this._pausedTime,this._initTime=this._startTime,d(this),this._pausedTime=a(),this.emit("play",this.object))},t.prototype.restart=function(t){return this._repeat=this._r,this.reassignValues(),d(this),this.emit("restart",this.object)},t.prototype.seek=function(t,e){var n=this,r=n._duration,i=(n._repeat,n._initTime),o=n._startTime,s=(n._delayTime,n._reversed),u=i+t;return this._isPlaying=!0,u<o&&o>=i&&(this._startTime-=r,this._reversed=!s),this.update(t,!1),this.emit("seek",t,this.object),e?this:this.pause()},t.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},t.prototype.to=function(t,e,n){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 r in e)if("function"==typeof this[r]){var i=Array.isArray(e[r])?e[r]:[e[r]],o=i[0],s=void 0===o?null:o,u=i[1],a=void 0===u?null:u,f=i[2],h=void 0===f?null:f,p=i[3],c=void 0===p?null:p;this[r](s,a,h,c)}return this},t.prototype.render=function(){if(this._rendered)return this;var t=this,r=t._valuesStart,i=t._valuesEnd,o=t.object,s=t.Renderer,u=t.node,a=t.InitialValues;S(o),S(i),u&&a&&(o?i||(i=this._valuesEnd=a(u,o)):o=this.object=O(u,a(u,i),this));for(var f in i){var h=o&&o[f],p=i[f];if(m[f]){var c=m[f].prototype.update?new m[f](this,h,p,f,o):m[f](this,h,p,f,o);c&&(i[f]=c)}else"number"==typeof h&&isNaN(h)||null===h||null===p||void 0===h||void 0===p||h===p||(Array.isArray(p)&&"number"==typeof h&&p.unshift(h),r[f]=e(h),n(f,o,r,i))}return s&&this.node&&(this.__render=new s(this,o,i)),this},t.prototype.start=function(t){return this._startTime=void 0!==t?"string"==typeof t?a()+parseFloat(t):t:a(),this._startTime+=this._delayTime,this._initTime=this._prevTime=this._startTime,this._onStartCallbackFired=!1,this._rendered=!1,this._isPlaying=!0,d(this),this},t.prototype.stop=function(){var t=this,e=t._isPlaying,n=t._isFinite,r=t.object,i=t._startTime,o=(t._delayTime,t._duration),s=t._r,u=t._yoyo,a=t._reversed;if(!e)return this;var f=n?(s+1)%2==1&&u:a;return this._reversed=!1,f?this.update(i+o):this.update(i),y(this),this.emit("stop",r)},t.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this},t.prototype.chainedTweens=function(){if(this._chainedTweensCount=arguments.length,!this._chainedTweensCount)return this;for(var t=0,e=this._chainedTweensCount;t<e;t++)this["_chainedTweens"+t]=arguments[t];return this},t.prototype.repeat=function(t){return this._repeat=this._duration?"function"==typeof t?t(this._repeat):t:0,this._r=this._repeat,this._isFinite=isFinite(t),this},t.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},t.prototype.yoyo=function(t,e){return this._yoyo="function"==typeof t?t(this._yoyo):null===t?this._yoyo:t,t||(this._reversed=!1),this._easingReverse=e||null,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return"function"==typeof t&&(this._interpolationFunction=t),this},t.prototype.reassignValues=function(t){var e=this,n=e._valuesStart,r=e.object,i=e._delayTime;this._isPlaying=!0,this._startTime=void 0!==t?t:a(),this._startTime+=i,this._reversed=!1,d(this);for(var o in n){var s=n[o];r[o]=s}return this},t.prototype.update=function(t,e,n){var i,o,s,u=this,f=u._onStartCallbackFired,h=u._easingFunction,p=u._interpolationFunction,c=u._easingReverse,l=u._repeat,d=u._delayTime,_=u._reverseDelayTime,v=u._yoyo,m=u._reversed,g=u._startTime,T=u._prevTime,b=u._duration,w=u._valuesStart,O=u._valuesEnd,M=u.object,j=u._isFinite,I=u._isPlaying,P=u.__render,A=u._chainedTweensCount;if(b){t=void 0!==t?t:a();var L=g-T;if(L>250&&(g-=L-50/3,this._startTime=g),this._prevTime=t,!I||t<g&&!n)return!0;i=(i=(t-g)/b)>1?1:i,i=m?1-i:i}else i=1;if(f||(this._rendered||(this.render(),this._rendered=!0),this.emit("start",M),this._onStartCallbackFired=!0),o=m?c||h:h,!M)return!0;for(s in O){var F=w[s];if(void 0!==F&&null!==F){var S=O[s],q=o[s]?o[s](i):"function"==typeof o?o(i):k(i);"number"==typeof S?M[s]=((F+(S-F)*q)*x|0)/x:Array.isArray(S)&&"number"==typeof F?M[s]=p(S,q):S&&S.update?S.update(q):"function"==typeof S?M[s]=S(q):r(s,M,w,O,q,i)}}if(P&&P.update(M,i),this.emit("update",M,i),1===i||m&&!i){if(l>0&&b>0)return j&&this._repeat--,v&&(this._reversed=!m),this.emit(v&&!m?"reverse":"repeat",M),this._startTime=m&&_?t-_:t+d,!0;if(e||(this._isPlaying=!1,y(this),C--),this.emit("complete",M),this._repeat=this._r,A)for(var R=0;R<A;R++)this["_chainedTweens"+R].start(t+b);return!1}return!0},t}(),R=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),D=this&&this.__assign||Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},E=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},B=0,N=function(t){function e(e){var n=t.call(this)||this;return n._duration=0,n._startTime=a(),n._tweens=[],n.elapsed=0,n._id=B++,n._defaultParams=e,n.position=new b,n.position.addLabel("afterLast",n._duration),n.position.addLabel("afterInit",n._startTime),n}return R(e,t),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 s=n.stagger;return s||(s=(n.duration||1e3)/(e.length-1)),e.map(function(t,e){return s*e+r})}if("oneByOne"===t)return e.map(function(t){return n.duration});if("shuffle"===t){var u=n.stagger;return E(e.map(function(t,e){return(u||0)*e+r}))}var a=n.stagger;return e.map(function(t,e){return(a||0)*e+r})},e.prototype.fromTo=function(t,e,n,r){if((t=M(t,!0))&&t.length){this._defaultParams&&(r=D({},this._defaultParams,r));for(var i=r.label,o="number"==typeof i?i:this.position.parseLabel(void 0!==i?i:"afterLast",null),s=this.getTiming(r.mode,t,r,o),u=0,a=void 0,f=t.length;u<f;u++)a=t[u],this.add(q.fromTo(a,"function"==typeof e?e(u,t.length):D({},e),"function"==typeof n?n(u,t.length):n,"function"==typeof r?r(u,t.length):r),s[u])}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=0,n=this._tweens.length;e<n;e++){var r=this._tweens[e];t(r,e),this._duration=Math.max(this._duration,r._duration+r._startTime)}return this},e.prototype.add=function(t,e){var n=this;if(Array.isArray(t))return t.map(function(t){n.add(t,e)}),this;"object"!=typeof t||t instanceof q||(t=new q(t.from).to(t.to,t));var r=this,i=r._defaultParams,o=r._duration;if(i)for(var s in i)"function"==typeof t[s]&&t[s](i[s]);var u="number"==typeof e?e:this.position.parseLabel(void 0!==e?e:"afterLast",null);return t._startTime=Math.max(this._startTime,t._delayTime,u),t._delayTime=u,t._isPlaying=!0,this._duration=Math.max(o,t._startTime+t._delayTime+t._duration),this._tweens.push(t),this.position.setLabel("afterLast",this._duration),this},e.prototype.restart=function(){return this._startTime+=a(),d(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._reverseDelayTime,o=e._startTime,s=e._reversed,u=e._yoyo,a=e._repeat,f=e._isFinite;if(!e._isPlaying||t<o)return!0;var h=(t-o)/r;h=h>1?1:h,h=s?1-h:h,this.elapsed=h;for(var p=t-o,c=s?r-p:p,l=0;l<n.length;)n[l].update(c),l++;if(this.emit("update",h,p),1===h||s&&0===h){if(a){for(f&&this._repeat--,this.emit(s?"reverse":"repeat"),u&&(this._reversed=!s,this.timingOrder(function(t){return t.reverse()})),this._startTime=s&&i?t+i:t,l=0;l<n.length;)n[l].reassignValues(t),l++;return!0}return this.emit("complete"),this._repeat=this._r,y(this),this._isPlaying=!1,!1}return!0},e.prototype.progress=function(t){return void 0!==t?this.update(t*this._duration):this.elapsed},e}(q);t.Plugins=m,t.Selector=M,t.onTick=function(t){return f.push({update:t})},t.has=function(t){return null!==_(t)},t.get=_,t.getAll=function(){return f},t.removeAll=function(){f.length=0},t.remove=y,t.add=d,t.now=a,t.update=v,t.autoPlay=function(t){p=t},t.isRunning=function(){return h},t.Tween=q,t.Easing=g,t.Interpolation=T,t.Timeline=N,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";function e(t){if(void 0===t||"object"!=typeof t)return t;if(Array.isArray(t))return[].concat(t);if("object"==typeof t){var r={};for(var n in t)r[n]=e(t[n]);return r}return t}function r(t,e,n,i){var o=n[t],s=i[t];if("string"==typeof o&&"string"==typeof s){var u=o.match(j).map(function(t){return P(t)?t:+t}),a=s.match(j).map(function(t,e){return P(t)?t:+t});return u.unshift(M),n[t]=u,i[t]=a,!0}if("object"==typeof o&&"object"==typeof s){if(Array.isArray(o))return o.map(function(n,i){return r(i,e[t],o,s)});for(var f in s)r(f,e[t],o,s);return!0}return!1}function n(t,e,r,i,o,s){var u=r[t],a=i[t];if(void 0===a)return u;if(void 0===u||"string"==typeof u||u===a)return a;if("object"==typeof u&&"object"==typeof a){if(!u||!a)return e[t];if(u[0]===M){for(var f="",h=1,p=u.length;h<p;h++){c="string"==typeof a[h-1];f+="number"!=typeof a[h-1]?u[h]:((c?u[h]+ +a[h-1]:u[h]+(a[h-1]-u[h])*o)*x|0)/x,1===s&&(u[h]=u[h]+ +a[h-1])}return e[t]=f,f}if(Array.isArray(u))for(var h=0,p=u.length;h<p;h++)u[h]!==a[h]&&n(h,e[t],u,a,o,s);else for(var h in u)u[h]!==a[h]&&n(h,e[t],u,a,o,s)}else if("number"==typeof u){var c="string"==typeof a;e[t]=((c?u+ +a*o:u+(a-u)*o)*x|0)/x,c&&1===s&&(r[t]=e[t])}else"function"==typeof a&&(e[t]=a(o));return e[t]}var i,o="undefined"!=typeof window?window:"undefined"!=typeof global?global:this,s=o.requestAnimationFrame||function(t){return o.setTimeout(t,16)},u=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=[],h=!1,p=!1,c=s,l=u,d=function(t){var e=f.indexOf(t);if(e>-1&&f.splice(e,1),f.length>0){e=f.length-1;var r=f[e];t.prev=r,r.next=t}f.push(t),p&&!h&&(i=c(v),h=!0)},_=function(t){for(var e=0;e<f.length;e++)if(t===f[e])return f[e];return null},y=function(t){var e=f.indexOf(t);-1!==e&&f.splice(e,1)},v=function(t,e){if(t=void 0!==t?t:a(),p&&h&&(i=c(v)),!f.length)return l(i),h=!1,!1;for(var r=0;r<f.length;)f[r++].update(t,e);return!0},m={},g={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-g.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*g.Bounce.In(2*t):.5*g.Bounce.Out(2*t-1)+.5}},Stepped:{steps:function(t){return function(e){return(e*t|0)/t}}}},T={Linear:function(t,e){var r=t.length-1,n=r*e,i=Math.floor(n),o=T.Utils.Linear;return e<0?o(t[0],t[1],n):e>1?o(t[r],t[r-1],r-n):o(t[i],t[i+1>r?r:i+1],n-i)},Bezier:function(t,e){for(var r=0,n=t.length-1,i=Math.pow,o=T.Utils.Bernstein,s=0;s<=n;s++)r+=i(1-e,n-s)*i(e,s)*t[s]*o(n,s);return r},CatmullRom:function(t,e){var r=t.length-1,n=r*e,i=Math.floor(n),o=T.Utils.CatmullRom;return t[0]===t[r]?(e<0&&(i=Math.floor(n=r*(1+e))),o(t[(i-1+r)%r],t[i],t[(i+1)%r],t[(i+2)%r],n-i)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[r]-(o(t[r],t[r],t[r-1],t[r-1],n-r)-t[r]):o(t[i?i-1:0],t[i],t[r<i+1?r:i+1],t[r<i+2?r:i+2],n-i)},Utils:{Linear:function(t,e,r){return"function"==typeof t?t(r):(e-t)*r+t},Bernstein:function(t,e){var r=T.Utils.Factorial;return r(t)/r(e)/r(t-e)},Factorial:function(){var t=[1];return function(e){var r=1;if(t[e])return t[e];for(var n=e;n>1;n--)r*=n;return t[e]=r,r}}(),CatmullRom:function(t,e,r,n,i){var o=.5*(r-t),s=.5*(n-e),u=i*i;return(2*e-2*r+o+s)*(i*u)+(-3*e+3*r-2*o-s)*u+o*i+e}}},b=function(){function t(){this.totalTime=0,this.labels=[],this.offsets=[]}return t.prototype.parseLabel=function(t,e){var r=this,n=r.offsets,i=r.labels,o=i.indexOf(t);if("string"==typeof t&&-1!==t.indexOf("=")&&!e&&-1===o){var s=t.substr(t.indexOf("=")-1,2),u=t.split(s);e=2===u.length?s+u[1]:null,t=u[0],o=i.indexOf(t)}if(-1!==o&&t){var a=n[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},t.prototype.addLabel=function(t,e){return this.labels.push(t),this.offsets.push(this.parseLabel(t,e)),this},t.prototype.setLabel=function(t,e){var r=this.labels.indexOf(t);return-1!==r&&this.offsets.splice(r,1,this.parseLabel(t,e)),this},t.prototype.eraseLabel=function(t){var e=this.labels.indexOf(t);return-1!==e&&(this.labels.splice(e,1),this.offsets.splice(e,1)),this},t}(),w={},O=function(t,e,r){if(!t||!t.nodeType)return e;var n=t.queueID||"q_"+Date.now();t.queueID||(t.queueID=n);var i=w[n];if(i){if(i.object!==e||t!==i.tween.node||r._startTime!==i.tween._startTime){for(var o in e)o in i.object&&(r._startTime===i.tween._startTime?delete i.object[o]:i.propNormaliseRequired=!0);return e}return y(i.tween),i.object}return w[n]={tween:r,object:e,propNormaliseRequired:!1},w[n].object},I=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},M="STRING_PROP",j=/\s+|([A-Za-z?().,{}:""[\]#\%]+)|([-+]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,P=function(t){return isNaN(+t)||"+"===t[0]||"-"===t[0]||""===t||" "===t},x=Math.pow(10,4),A=/([.\[])/g,L=/\]/g,q=function(t,e){var r=t[e],n=e.replace(L,"").split(A),i=n.length-1,o=Array.isArray(t),s="object"==typeof t&&!o;return s?(t[e]=null,delete t[e]):o&&t.splice(e,1),n.reduce(function(t,e,u){o&&"."!==e&&"["!==e&&(e*=1);var a="["===n[u+1];if("."===e||"["===e)return"."===e?(s=!0,o=!1):"["===e&&(s=!1,o=!0),t;if(void 0===t[e]){if(o||s)return t[e]=u===i?r:o||a?[]:s?{}:null,s=o=!1,t[e]}else if(void 0!==t[e])return u===i&&(t[e]=r),t[e];return t},t)},F=function(t){if("object"==typeof t&&t)for(var e in t)if(-1!==e.indexOf(".")||-1!==e.indexOf("["))q(t,e);else if("object"==typeof t[e]&&t[e]){var r=t[e];for(var n in r)if(-1!==n.indexOf(".")||-1!==n.indexOf("["))q(r,n);else if("object"==typeof r[n]&&r[n]){var i=r[n];for(var o in i)-1===o.indexOf(".")&&-1===o.indexOf("[")||q(i,o)}}return t},S=0,C=g.Linear.None,k=function(){function t(t,e){return this._chainedTweensCount=0,this.id=S++,!t||"object"!=typeof t||e||t.nodeType?t&&(t.nodeType||t.length||"string"==typeof t)&&(t=this.node=I(t),e=this.object=O(t,e,this)):(e=this.object=t,t=null),this._valuesEnd=null,this._valuesStart={},this._duration=1e3,this._easingFunction=C,this._easingReverse=C,this._interpolationFunction=T.Linear,this._startTime=0,this._initTime=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._maxListener=15,this._prevTime=null,this}return t.fromTo=function(e,r,n,i){void 0===i&&(i={}),i.quickRender=i.quickRender?i.quickRender:!n;var o=new t(e,r).to(n,i);return i.quickRender&&(o.render().update(o._startTime),o._rendered=!1,o._onStartCallbackFired=!1),o},t.to=function(e,r,n){return t.fromTo(e,null,r,n)},t.from=function(e,r,n){return t.fromTo(e,r,null,n)},t.prototype.setMaxListener=function(t){return void 0===t&&(t=15),this._maxListener=t,this},t.prototype.on=function(t,e){for(var r=this._maxListener,n=t+"Callback",i=0;i<r;i++){var o=n+i;if(!this[o]){this[o]=e;break}}return this},t.prototype.once=function(t,e){return this},t.prototype.off=function(t,e){for(var r=this._maxListener,n=t+"Callback",i=0;i<r;i++){var o=n+i;this[o]===e&&(this[o]=null)}return this},t.prototype.emit=function(t,e,r,n,i){var o=this._maxListener,s=t+"Callback";if(!this[s+0])return this;for(var u=0;u<o;u++){var a=s+u;this[a]&&this[a](e,r,n,i)}return this},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isStarted=function(){return this._onStartCallbackFired},t.prototype.reverse=function(t){var e=this._reversed;return this._reversed=void 0!==t?t:!e,this},t.prototype.reversed=function(){return this._reversed},t.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,y(this),this._pausedTime=a(),this.emit("pause",this.object)):this},t.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=a()-this._pausedTime,this._initTime=this._startTime,d(this),this._pausedTime=a(),this.emit("play",this.object))},t.prototype.restart=function(t){return this._repeat=this._r,this.reassignValues(),d(this),this.emit("restart",this.object)},t.prototype.seek=function(t,e){var r=this,n=r._duration,i=(r._repeat,r._initTime),o=r._startTime,s=(r._delayTime,r._reversed),u=i+t;return this._isPlaying=!0,u<o&&o>=i&&(this._startTime-=n,this._reversed=!s),this.update(t,!1),this.emit("seek",t,this.object),e?this:this.pause()},t.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},t.prototype.to=function(t,e,r){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 n in e)if("function"==typeof this[n]){var i=Array.isArray(e[n])?e[n]:[e[n]],o=i[0],s=void 0===o?null:o,u=i[1],a=void 0===u?null:u,f=i[2],h=void 0===f?null:f,p=i[3],c=void 0===p?null:p;this[n](s,a,h,c)}return this},t.prototype.render=function(){if(this._rendered)return this;var t=this,n=t._valuesStart,i=t._valuesEnd,o=t.object,s=t.Renderer,u=t.node,a=t.InitialValues;if(u&&u.queueID&&w[u.queueID]){var f=w[u.queueID];if(f.propNormaliseRequired&&f.tween!==this){for(var h in i)void 0!==f.tween._valuesEnd[h]&&delete f.tween._valuesEnd[h];f.normalisedProp=!0,f.propNormaliseRequired=!1}}F(o),F(i),u&&a&&(o?i||(i=this._valuesEnd=a(u,o)):o=this.object=O(u,a(u,i),this));for(var h in i){var p=o&&o[h],c=i[h];if(m[h]){var l=m[h].prototype.update?new m[h](this,p,c,h,o):m[h](this,p,c,h,o);l&&(i[h]=l)}else"number"==typeof p&&isNaN(p)||null===p||null===c||void 0===p||void 0===c||p===c||(Array.isArray(c)&&"number"==typeof p&&c.unshift(p),n[h]=e(p),r(h,o,n,i))}return s&&this.node&&(this.__render=new s(this,o,i)),this},t.prototype.start=function(t){return this._startTime=void 0!==t?"string"==typeof t?a()+parseFloat(t):t:a(),this._startTime+=this._delayTime,this._initTime=this._prevTime=this._startTime,this._onStartCallbackFired=!1,this._rendered=!1,this._isPlaying=!0,d(this),this},t.prototype.stop=function(){var t=this,e=t._isPlaying,r=t._isFinite,n=t.object,i=t._startTime,o=(t._delayTime,t._duration),s=t._r,u=t._yoyo,a=t._reversed;if(!e)return this;var f=r?(s+1)%2==1:!a;return this._reversed=!1,u&&f?this.update(i):this.update(i+o),y(this),this.emit("stop",n)},t.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this},t.prototype.chainedTweens=function(){if(this._chainedTweensCount=arguments.length,!this._chainedTweensCount)return this;for(var t=0,e=this._chainedTweensCount;t<e;t++)this["_chainedTweens"+t]=arguments[t];return this},t.prototype.repeat=function(t){return this._repeat=this._duration?"function"==typeof t?t(this._repeat):t:0,this._r=this._repeat,this._isFinite=isFinite(t),this},t.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},t.prototype.yoyo=function(t,e){return this._yoyo="function"==typeof t?t(this._yoyo):null===t?this._yoyo:t,t||(this._reversed=!1),this._easingReverse=e||null,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return"function"==typeof t&&(this._interpolationFunction=t),this},t.prototype.reassignValues=function(t){var e=this,r=e._valuesStart,n=e.object,i=e._delayTime;this._isPlaying=!0,this._startTime=void 0!==t?t:a(),this._startTime+=i,this._reversed=!1,d(this);for(var o in r){var s=r[o];n[o]=s}return this},t.prototype.update=function(t,e,r){var i,o,s,u=this,f=u._onStartCallbackFired,h=u._easingFunction,p=u._interpolationFunction,c=u._easingReverse,l=u._repeat,d=u._delayTime,_=u._reverseDelayTime,v=u._yoyo,m=u._reversed,g=u._startTime,T=u._prevTime,b=u._duration,w=u._valuesStart,O=u._valuesEnd,I=u.object,M=u._isFinite,j=u._isPlaying,P=u.__render,A=u._chainedTweensCount,L=0;if(b){var q=(t=void 0!==t?t:a())-T;if(q>250&&(t+=q-50/3),this._prevTime=t,!j||t<g&&!r)return!0;i=(i=(t-g)/b)>1?1:i,i=m?1-i:i}else i=1;if(f||(this._rendered||(this.render(),this._rendered=!0),this.emit("start",I),this._onStartCallbackFired=!0),o=m?c||h:h,!I)return!0;for(s in O){var F=w[s];if(void 0!==F&&null!==F){var k=O[s],R=o[s]?o[s](i):"function"==typeof o?o(i):C(i);"number"==typeof k?I[s]=((F+(k-F)*R)*x|0)/x:Array.isArray(k)&&"number"==typeof F?I[s]=p(k,R):k&&k.update?k.update(R):"function"==typeof k?I[s]=k(R):n(s,I,w,O,R,i),L++}}if(!L)return y(this),!1;if(P&&P.update(I,i),this.emit("update",I,i,t),1===i||m&&!i){if(l>0&&b>0)return M&&this._repeat--,v&&(this._reversed=!m),this.emit(v&&!m?"reverse":"repeat",I),this._startTime=m&&_?t-_:t+d,!0;if(e||(this._isPlaying=!1,y(this),S--),this.emit("complete",I),this._repeat=this._r,A)for(var D=0;D<A;D++)this["_chainedTweens"+D].start(t+b);return!1}return!0},t}(),R=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),D=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},E=function(t){var e,r,n;for(n=t.length;n;n-=1)e=Math.floor(Math.random()*n),r=t[n-1],t[n-1]=t[e],t[e]=r;return t},N=0,B=function(t){function e(e){var r=t.call(this)||this;return r._duration=0,r._startTime=a(),r._tweens=[],r.elapsed=0,r._id=N++,r._defaultParams=e,r.position=new b,r.position.addLabel("afterLast",r._duration),r.position.addLabel("afterInit",r._startTime),r}return R(e,t),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,r){t._startTime=e[r]}),this},e.prototype.getTiming=function(t,e,r,n){if(void 0===n&&(n=0),"reverse"===t){var i=r.stagger,o=(i||0)*(e.length-1);return e.map(function(t,e){return o-(i||0)*e+n})}if("async"===t)return e.map(function(t){return n});if("sequence"===t||"delayed"===t){var s=r.stagger;return s||(s=(r.duration||1e3)/(e.length-1)),e.map(function(t,e){return s*e+n})}if("oneByOne"===t)return e.map(function(t){return r.duration});if("shuffle"===t){var u=r.stagger;return E(e.map(function(t,e){return(u||0)*e+n}))}var a=r.stagger;return e.map(function(t,e){return(a||0)*e+n})},e.prototype.fromTo=function(t,e,r,n){if((t=I(t,!0))&&t.length){this._defaultParams&&(n=D({},this._defaultParams,n));for(var i=n.label,o="number"==typeof i?i:this.position.parseLabel(void 0!==i?i:"afterLast",null),s=this.getTiming(n.mode,t,n,o),u=0,a=void 0,f=t.length;u<f;u++)a=t[u],this.add(k.fromTo(a,"function"==typeof e?e(u,t.length):D({},e),"function"==typeof r?r(u,t.length):r,"function"==typeof n?n(u,t.length):n),s[u])}return this.start()},e.prototype.from=function(t,e,r){return this.fromTo(t,e,null,r)},e.prototype.to=function(t,e,r){return this.fromTo(t,null,e,r)},e.prototype.addLabel=function(t,e){return this.position.addLabel(t,e),this},e.prototype.map=function(t){for(var e=0,r=this._tweens.length;e<r;e++){var n=this._tweens[e];t(n,e),this._duration=Math.max(this._duration,n._duration+n._startTime)}return this},e.prototype.add=function(t,e){var r=this;if(Array.isArray(t))return t.map(function(t){r.add(t,e)}),this;"object"!=typeof t||t instanceof k||(t=new k(t.from).to(t.to,t));var n=this,i=n._defaultParams,o=n._duration;if(i)for(var s in i)"function"==typeof t[s]&&t[s](i[s]);var u="number"==typeof e?e:this.position.parseLabel(void 0!==e?e:"afterLast",null);return t._startTime=Math.max(this._startTime,t._delayTime,u),t._delayTime=u,t._isPlaying=!0,this._duration=Math.max(o,t._startTime+t._delayTime+t._duration),this._tweens.push(t),this.position.setLabel("afterLast",this._duration),this},e.prototype.restart=function(){return this._startTime+=a(),d(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,r=e._tweens,n=e._duration,i=e._reverseDelayTime,o=e._startTime,s=e._reversed,u=e._yoyo,a=e._repeat,f=e._isFinite;if(!e._isPlaying||t<o)return!0;var h=(t-o)/n;h=h>1?1:h,h=s?1-h:h,this.elapsed=h;for(var p=t-o,c=s?n-p:p,l=0;l<r.length;)r[l].update(c),l++;if(this.emit("update",h,p),1===h||s&&0===h){if(a){for(f&&this._repeat--,this.emit(s?"reverse":"repeat"),u&&(this._reversed=!s,this.timingOrder(function(t){return t.reverse()})),this._startTime=s&&i?t+i:t,l=0;l<r.length;)r[l].reassignValues(t),l++;return!0}return this.emit("complete"),this._repeat=this._r,y(this),this._isPlaying=!1,!1}return!0},e.prototype.progress=function(t){return void 0!==t?this.update(t*this._duration):this.elapsed},e}(k);t.Plugins=m,t.Selector=I,t.onTick=function(t){return f.push({update:t})},t.has=function(t){return null!==_(t)},t.get=_,t.getAll=function(){return f},t.removeAll=function(){f.length=0},t.remove=y,t.add=d,t.now=a,t.update=v,t.autoPlay=function(t){p=t},t.isRunning=function(){return h},t.Tween=k,t.Easing=g,t.Interpolation=T,t.Timeline=B,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "es6-tween",
"version": "4.0.1",
"version": "4.0.2",
"description": "ES6 implementation of amazing tween.js",

@@ -53,5 +53,3 @@ "browser": "full/Tween.min.js",

},
"dependencies": {
"intertween": "0.0.25"
}
"dependencies": {}
}

@@ -39,3 +39,2 @@ // Frame lag-fix constants

}
;
var isNaNForST = function (v) { return isNaN(+v) || v[0] === '+' || v[0] === '-' || v === '' || v === ' '; };

@@ -67,3 +66,2 @@ // Decompose value, now for only `string` that required

}
;
// Recompose value

@@ -125,3 +123,2 @@ export var DECIMAL = Math.pow(10, 4);

}
;
// Dot notation => Object structure converter

@@ -128,0 +125,0 @@ // example

@@ -0,1 +1,2 @@

export declare const Store: {};
export default function (node: any, object: any, tween: any): any;
import { remove } from './core';
var Store = {};
export var Store = {};
export default function (node, object, tween) {

@@ -13,3 +13,5 @@ if (!node || !node.nodeType) {

if (storeID) {
if (storeID.object === object && node === storeID.tween.node) {
if (storeID.object === object &&
node === storeID.tween.node &&
tween._startTime === storeID.tween._startTime) {
remove(storeID.tween);

@@ -20,5 +22,8 @@ }

if (prop in storeID.object) {
if (tween.startTime === storeID.tween.startTime) {
if (tween._startTime === storeID.tween._startTime) {
delete storeID.object[prop];
}
else {
storeID.propNormaliseRequired = true;
}
}

@@ -30,4 +35,4 @@ }

}
Store[ID] = { tween: tween, object: object };
return Store[ID];
Store[ID] = { tween: tween, object: object, propNormaliseRequired: false };
return Store[ID].object;
}

@@ -22,3 +22,3 @@ var __extends = (this && this.__extends) || (function () {

import Tween from './Tween';
import { EVENT_COMPLETE, EVENT_REPEAT, EVENT_REVERSE, EVENT_RESTART, EVENT_UPDATE, } from './constants';
import { EVENT_COMPLETE, EVENT_REPEAT, EVENT_REVERSE, EVENT_RESTART, EVENT_UPDATE } from './constants';
import Selector from './selector';

@@ -25,0 +25,0 @@ export var shuffle = function (a) {

import { add, now, Plugins, remove } from './core';
import Easing from './Easing';
import Interpolation from './Interpolation';
import NodeCache from './NodeCache';
import NodeCache, { Store } from './NodeCache';
import Selector from './selector';
import { decompose, recompose, deepCopy, SET_NESTED, EVENT_CALLBACK, CHAINED_TWEENS, EVENT_UPDATE, EVENT_COMPLETE, EVENT_START, EVENT_REPEAT, EVENT_REVERSE, EVENT_PAUSE, EVENT_PLAY, EVENT_RESTART, EVENT_STOP, EVENT_SEEK, FRAME_MS, TOO_LONG_FRAME_MS, DECIMAL } from './constants';
import { decompose, recompose, deepCopy, SET_NESTED, EVENT_CALLBACK, CHAINED_TWEENS, EVENT_UPDATE, EVENT_COMPLETE, EVENT_START, EVENT_REPEAT, EVENT_REVERSE, EVENT_PAUSE, EVENT_PLAY, EVENT_RESTART, EVENT_STOP, EVENT_SEEK, FRAME_MS, TOO_LONG_FRAME_MS, DECIMAL, } from './constants';
var _id = 0; // Unique ID

@@ -49,3 +49,3 @@ var defaultEasing = Easing.Linear.None;

this._isFinite = true;
this._maxListener = 5;
this._maxListener = 15;
this._prevTime = null;

@@ -105,3 +105,3 @@ return this;

Tween.prototype.setMaxListener = function (count) {
if (count === void 0) { count = 5; }
if (count === void 0) { count = 15; }
this._maxListener = count;

@@ -123,4 +123,4 @@ return this;

this[callbackId] = callback;
break;
}
break;
}

@@ -287,3 +287,3 @@ return this;

this._isPlaying = true;
if (updateTime < _startTime && (_startTime >= _initTime)) {
if (updateTime < _startTime && _startTime >= _initTime) {
this._startTime -= _duration;

@@ -341,2 +341,15 @@ this._reversed = !_reversed;

var _a = this, _valuesStart = _a._valuesStart, _valuesEnd = _a._valuesEnd, object = _a.object, Renderer = _a.Renderer, node = _a.node, InitialValues = _a.InitialValues, _easingFunction = _a._easingFunction;
if (node && node.queueID && Store[node.queueID]) {
var prevTweenByNode = Store[node.queueID];
if (prevTweenByNode.propNormaliseRequired &&
prevTweenByNode.tween !== this) {
for (var property in _valuesEnd) {
if (prevTweenByNode.tween._valuesEnd[property] !== undefined) {
delete prevTweenByNode.tween._valuesEnd[property];
}
}
prevTweenByNode.normalisedProp = true;
prevTweenByNode.propNormaliseRequired = false;
}
}
SET_NESTED(object);

@@ -364,3 +377,8 @@ SET_NESTED(_valuesEnd);

}
if ((typeof start === 'number' && isNaN(start)) || start === null || end === null || start === undefined || end === undefined || start === end) {
if ((typeof start === 'number' && isNaN(start)) ||
start === null ||
end === null ||
start === undefined ||
end === undefined ||
start === end) {
continue;

@@ -408,9 +426,9 @@ }

}
var atEnd = _isFinite ? ((_r + 1) % 2 === 1) && _yoyo : _reversed;
var atStart = _isFinite ? (_r + 1) % 2 === 1 : !_reversed;
this._reversed = false;
if (atEnd) {
this.update(_startTime + _duration);
if (_yoyo && atStart) {
this.update(_startTime);
}
else {
this.update(_startTime);
this.update(_startTime + _duration);
}

@@ -454,3 +472,5 @@ remove(this);

Tween.prototype.repeat = function (amount) {
this._repeat = !this._duration ? 0 : typeof amount === 'function' ? amount(this._repeat) : amount;
this._repeat = !this._duration
? 0
: typeof amount === 'function' ? amount(this._repeat) : amount;
this._r = this._repeat;

@@ -542,2 +562,3 @@ this._isFinite = isFinite(amount);

var property;
var propCount = 0;
if (!_duration) {

@@ -548,6 +569,5 @@ elapsed = 1;

time = time !== undefined ? time : now();
var delta = _startTime - _prevTime;
var delta = time - _prevTime;
if (delta > TOO_LONG_FRAME_MS) {
_startTime -= delta - FRAME_MS;
this._startTime = _startTime;
time += delta - FRAME_MS;
}

@@ -582,5 +602,10 @@ this._prevTime = time;

var end = _valuesEnd[property];
var value = currentEasing[property] ? currentEasing[property](elapsed) : typeof currentEasing === 'function' ? currentEasing(elapsed) : defaultEasing(elapsed);
var value = currentEasing[property]
? currentEasing[property](elapsed)
: typeof currentEasing === 'function'
? currentEasing(elapsed)
: defaultEasing(elapsed);
if (typeof end === 'number') {
object[property] = (((start + (end - start) * value) * DECIMAL) | 0) / DECIMAL;
object[property] =
(((start + (end - start) * value) * DECIMAL) | 0) / DECIMAL;
}

@@ -599,7 +624,12 @@ else if (Array.isArray(end) && typeof start === 'number') {

}
propCount++;
}
if (!propCount) {
remove(this);
return false;
}
if (__render) {
__render.update(object, elapsed);
}
this.emit(EVENT_UPDATE, object, elapsed);
this.emit(EVENT_UPDATE, object, elapsed, time);
if (elapsed === 1 || (_reversed && !elapsed)) {

@@ -606,0 +636,0 @@ if (_repeat > 0 && _duration > 0) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc