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 2.4.0 to 2.4.1

106

dist/Tween.js

@@ -141,3 +141,3 @@ (function (global, factory) {

var add = function (tween) {
var add$1 = function (tween) {
var id = tween.id;

@@ -971,3 +971,3 @@ _tweens[id] = tween;

this._startTime += now$1() - this._pausedTime;
add(this);
add$1(this);
this._pausedTime = now$1();

@@ -983,3 +983,3 @@

if (!this._isPlaying) {
add(this);
add$1(this);
}

@@ -1098,3 +1098,3 @@

add(this);
add$1(this);

@@ -1386,3 +1386,9 @@ this.emit('start', this.object);

borderColor : 1,
outlineColor: 1
outlineColor: 1,
boxShadowColor: 1,
textShadowColor: 1
},
scroll: {
scrollTop: 1,
scrollLeft: 1
}

@@ -1396,5 +1402,5 @@ };

return {
update: function update(Tween, RenderObject) {
update: function update(RenderObject, value) {
for (var p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) { continue; }
if (cache.transform[p] || cache.filter[p] || cache.color[p] || cache.scroll[p]) { continue; }
layer.setAttribute(p, RenderObject[p]);

@@ -1407,8 +1413,9 @@ }

var layer = this.domNode;
var decimalRegExp = /\.([0-9]+)/g;
var style = layer.style;
var decimalRegExp = /\.([0-9]+)/g, replaceTo = '';
return {
update: function update(Tween, RenderObject) {
update: function update(RenderObject) {
for (var p in RenderObject) {
if (!cache.color[p]) { continue; }
layer.style[p] = RenderObject[p].replace(decimalRegExp, '');
style[p] = RenderObject[p].replace(decimalRegExp, replaceTo);
}

@@ -1422,5 +1429,5 @@ }

return {
update: function update(Tween, RenderObject) {
update: function update(RenderObject) {
for (var p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) { continue; }
if (cache.transform[p] || cache.filter[p] || cache.color[p]) { continue; }
style[p] = RenderObject[p];

@@ -1435,6 +1442,6 @@ }

return {
update: function update(Tween, RenderObject) {
update: function update(RenderObject) {
var transform = '';
for (var p in RenderObject) {
if (cache.filter[p]) { continue; }
if (!cache.transform[p]) { continue; }
if (p === 'x' || p === 'y' || p === 'z') {

@@ -1454,17 +1461,16 @@ transform += ' translate3d( ' + (RenderObject.x || '0px') + ', ' + (RenderObject.y || '0px') + ', ' + (RenderObject.z || '0px') + ')';

var layer = this.domNode,
bbox = {};
return {
update: function update(Tween, RenderObject) {
var this$1 = this;
bbox = {}, self;
var attrName = 'transform', rotate = 'rotate', x = 'x', y = 'y';
return self = {
update: function update(RenderObject) {
var transform = '';
for (var p in RenderObject) {
if (!cache.transform[p]) { continue; }
if (!cache[attrName][p]) { continue; }
if (bbox.x === undefined || bbox.y === undefined) {
this$1.setOrigin(xPos, yPos);
self.setOrigin(xPos, yPos);
continue;
}
if (p === 'rotate') {
if (p === rotate) {
transform += " rotate(" + (RenderObject[p]) + " " + (bbox.x) + " " + (bbox.y) + ")";
} else if (p === 'x' || p === 'y') {
} else if (p === x || p === y) {
transform += " translate(" + (RenderObject.x || 0) + ", " + (RenderObject.y || 0) + ")";

@@ -1476,9 +1482,9 @@ } else {

if (transform) {
layer.setAttribute('transform', transform);
layer.setAttribute(attrName, transform);
}
return this;
return self;
},
init: function init(Tween, RenderObject) {
return this.setOrigin(xPos, yPos);
return self.setOrigin(xPos, yPos);

@@ -1507,3 +1513,3 @@ },

return this;
return self;
}

@@ -1516,6 +1522,6 @@ }

return {
update: function update(Tween, RenderObject) {
update: function update(RenderObject) {
var filter = '';
for (var p in RenderObject) {
if (cache.transform[p]) { continue; }
if (!cache.filter[p]) { continue; }
if (cache.filter[p]) {

@@ -1534,4 +1540,5 @@ filter += " " + p + "( " + (RenderObject[p]) + ")";

return {
update: function (Tween, RenderObject) {
update: function (RenderObject) {
for (var p in RenderObject) {
if (!cache.scroll[p]) { continue; }
layer[p] = RenderObject[p];

@@ -1557,4 +1564,6 @@ }

};
Composite.prototype.map = function map (type, object) {
Composite.prototype.map = function map (type) {
var this$1 = this;
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];

@@ -1569,3 +1578,3 @@

plugin && plugin[type] && plugin[type](this$1, object);
plugin && plugin[type] && plugin[type].apply(this$1, args);

@@ -1576,5 +1585,5 @@ }

};
Composite.prototype.render = function render (object) {
Composite.prototype.render = function render (object, value, elapsed) {
return this.map('update', object);
return this.map('update', object, value, elapsed);

@@ -1698,2 +1707,9 @@ };

};
Timeline.prototype.restart = function restart () {
this._startTime += now$1();
add(this);
return this.emit('restart');
};
Timeline.prototype.easing = function easing (easing$1) {

@@ -1706,4 +1722,2 @@ return this.map(function (tween) { return tween.easing(easing$1); });

Timeline.prototype.update = function update$$1 (time) {
var this$1 = this;
var ref = this;

@@ -1730,13 +1744,14 @@ var _tweens = ref._tweens;

var timing = time - _startTime;
timing = _reversed ? _totalDuration - timing : timing;
var _timing = _reversed ? _totalDuration - timing : timing;
for (var tween in _tweens) {
if (_tweens[tween].update(timing)) {
var _tween = _tweens[tween];
if (_tween.skip || _tween.update(_timing)) {
continue;
} else {
delete this$1._tweens[tween];
}
_tween.skip = true;
}
}
this.emit('update', elapsed);
this.emit('update', elapsed, timing);

@@ -1765,2 +1780,9 @@ if (elapsed === 1 || (_reversed && elapsed === 0)) {

}
for (var tween$1 in _tweens) {
var _tween$1 = _tweens[tween$1];
if (_tween$1.skip) {
_tween$1.skip = false;
}
}

@@ -1815,3 +1837,3 @@ return true;

exports.remove = remove;
exports.add = add;
exports.add = add$1;
exports.now = now$1;

@@ -1818,0 +1840,0 @@ exports.update = update;

@@ -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=t.TWEEN||{})}(this,function(t){"use strict";function e(t){for(var e="",n=0,i=t.length;n<i;n++)e+=t[n];return e}function n(t){var e=parseFloat(t);return"number"!=typeof e||isNaN(e)?t:e}function i(t){var e=t.from,n=t.to,i=t.duration;void 0===i&&(i=1e3);var r=t.easing;void 0===r&&(r=tt);var o=t.events,a=t.instance,s=new W(e,a).to(n,i).easing(tt);o&&(s._events=o),t.start=s.start.bind(s)}void 0===Object.assign&&(Object.assign=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return e.map(function(e){for(var n in e)t[n]=e[n]}),t});var r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof t?t:{},o=["webkit","moz","ms","o"],a="AnimationFrame",s="Request"+a,u="Cancel"+a,f="CancelRequest"+a,h=r.setTimeout,p=r.clearTimeout;if(h&&void 0===r.requestAnimationFrame){var c,l,d=Date.now(),v=50/3,y=v;o.map(function(t){void 0===(c=r[t+s])&&(c=function(t){return h(function(){l=Date.now(),t(l-d),y=v+(Date.now()-l)},y)})}),void 0!==c&&(r.requestAnimationFrame=c)}if(p&&void 0===r.cancelAnimationFrame&&void 0===(r.cancelAnimationFrame=r.cancelRequestAnimationFrame)){var m;o.map(function(t){void 0===(m=r[t+u])&&void 0===(m=r[t+f])&&(m=function(t){return p(t)})}),void 0!==m&&(r.cancelAnimationFrame=m)}void 0===Array.isArray&&(Array.isArray=function(t){return void 0!==t&&"object"==typeof t&&t.length&&void 0!==t.push&&void 0!==t.splice});var _,g={},b=!1,T=!1,w={},O="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},M=0;Object.defineProperty(g,"length",{enumerable:!1,writable:!0,value:0});var j=function(t,e,n,i,r,o){var a=this,s=w[t];if(s)for(var u=s.length;u--;)s[u].call(a,e,n,i,r,o)},F=function(t,e){void 0===w[t]&&(w[t]=[]),w[t].push(e)},I=function(t,e){void 0===w[t]&&(w[t]=[]),F(t,function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];e.apply(void 0,n),A(t)})},A=function(t,e){if(void 0!==t&&void 0!==w[t])if(void 0!==e)for(var n=w[name],i=0;i<n.length;)n[i]===e&&n.splice(i,1),i++;else w[name]=[]},P=function(t){var e=t.id;g[e]=t,g.length++,T&&!b&&(B(),b=!0,j("start")),j("add",t,g)},x=function(){var t=M;return M++,t},E=function(){return g},S=function(t){T=t},C=function(){g={},Object.defineProperty(g,"length",{enumerable:!1,writable:!0,value:0})},N=function(t){for(var e in g)if(t.id===+e)return g[+e];return null},D=function(t){return null!==N(t)},k=function(t){for(var e in g)t.id===+e&&(delete g[+e],g.length--)},q=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}}(),B=function(t,e){if(t=void 0!==t?t:q(),T&&(_=requestAnimationFrame(B)),j("update",t,g),0===g.length)return b=!1,cancelAnimationFrame(_),j("stop",t),!1;for(var n in g)g[n].update(t)||e?n++:(delete g[+n],g.length--);return!0};if(O.document){var R=O.document,L=0,z=0;R.addEventListener("visibilitychange",function(t){if(0===g.length)return!1;if(document.hidden)z=q();else{L=q()-z;for(var e in g)g[e]._startTime+=L}return!0})}var J={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*(-Math.pow(2,-10*(t-1))+2)}},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,t<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?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-J.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*J.Bounce.In(2*t):.5*J.Bounce.Out(2*t-1)+.5}}},U={Linear:function(t,e){var n=t.length-1,i=n*e,r=Math.floor(i),o=U.Utils.Linear;return e<0?o(t[0],t[1],i):e>1?o(t[n],t[n-1],n-i):o(t[r],t[r+1>n?n:r+1],i-r)},Bezier:function(t,e){for(var n=0,i=t.length-1,r=Math.pow,o=U.Utils.Bernstein,a=0;a<=i;a++)n+=r(1-e,i-a)*r(e,a)*t[a]*o(i,a);return n},CatmullRom:function(t,e){var n=t.length-1,i=n*e,r=Math.floor(i),o=U.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(r=Math.floor(i=n*(1+e))),o(t[(r-1+n)%n],t[r],t[(r+1)%n],t[(r+2)%n],i-r)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-i)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],i-n)-t[n]):o(t[r?r-1:0],t[r],t[n<r+1?n:r+1],t[n<r+2?n:r+2],i-r)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=U.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 i=e;i>1;i--)n*=i;return t[e]=n,n}}(),CatmullRom:function(t,e,n,i,r){var o=.5*(n-t),a=.5*(i-e),s=r*r,u=r*s;return(2*e-2*n+o+a)*u+(-3*e+3*n-2*o-a)*s+o*r+e}}},X=function(t,e,n){if(void 0===n&&(n=1e4),Array.isArray(t)){e=e.map(function(e,n){return e===t[n]?null:"number"==typeof e?e-t[n]:"string"==typeof e?e:X(t[n],e)});var i=[].concat(t);return function(r){for(var o=0,a=e.length;o<a;o++){var s=e[o];"function"==typeof s?i[o]=s(r):"number"==typeof s&&(i[o]=((t[o]+s*r)*n|0)/n)}return i}}if("object"==typeof t){for(var r in e)e[r]===t[r]?e[r]=null:"object"==typeof e[r]?e[r]=X(t[r],e[r]):"number"==typeof t[r]&&(e[r]-=t[r]);var o=Object.assign({},t);return function(i){for(var r in e){var a=e[r];"function"==typeof a?o[r]=a(i):"number"==typeof a&&(o[r]=((t[r]+a*i)*n|0)/n)}return o}}if("number"==typeof t){e-=t;var a=t===e;return function(i){return a?e:((t+e*i)*n|0)/n}}var s=t===e;return function(n){return s?t:n>=.5?e:t}},Y={add:function(t){return Y[t]&&JSON.stringify(t)&&JSON.stringify(Y[t])?Y[t]:(Y[t]=t,t)}},Z=/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi,Q=1e4,V=J.Linear.None,W=function t(e,i){return void 0===e&&(e={}),this.isJoinToString="string"==typeof e&&Z.test(e),e=this.isJoinToString?e.match(Z).map(n):e,this.object=e,this._valuesStart=t.createEmptyConst(e),this._valuesEnd=t.createEmptyConst(e),this._duration=1e3,this._easingFunction=V,this._interpolationFunction=U.None,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.id=x(),i&&i.to?new t(e).to(i.to,i):this};W.createEmptyConst=function(t){return"number"==typeof t?0:Array.isArray(t)?[]:"object"==typeof t?{}:""},W.checkValidness=function(t){return void 0!==t&&null!==t&&""!==t&&NaN!==t&&t!==1/0},W.prototype.isPlaying=function(){return this._isPlaying},W.prototype.isStarted=function(){return this._onStartCallbackFired},W.prototype.reverse=function(){var t=this,e=t._reversed;return this._reversed=!e,this},W.prototype.reversed=function(){return this._reversed},W.prototype.useActiveMode=function(){return this.object=Y.add(this.object),this},W.prototype.off=function(t,e){if(!this._events||void 0===this._events[t])return this;if(void 0!==t&&void 0!==e)for(var n=this._events[t],i=0;i<n.length;)n[i]===e&&n.splice(i,1),i++;else void 0!==t&&void 0===e&&(this._events[t]=[]);return this},W.prototype.on=function(t,e){return this._events&&void 0!==this._events[t]||(this._events||(this._events={}),this._events[t]=[]),this._events[t].push(e),this},W.prototype.once=function(t,e){var n=this;return this._events&&void 0!==this._events[t]||(this._events||(this._events={}),this._events[t]=[]),this.on(t,function(){for(var i=[],r=arguments.length;r--;)i[r]=arguments[r];e.call.apply(e,[n].concat(i)),n.off(t)})},W.prototype.emit=function(t,e,n,i,r,o){var a=this,s=this,u=s._events;if(!u)return this;var f=u[t];if(!f)return this;for(var h=f.length;h--;)f[h].call(a,e,n,i,r,o);return this},W.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,k(this),this._pausedTime=q(),this.emit("pause",this.object)):this},W.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=q()-this._pausedTime,P(this),this._pausedTime=q(),this.emit("play",this.object))},W.prototype.restart=function(t){return this._repeat=this._r,this._startTime=q()+(t?0:this._delayTime),this._isPlaying||P(this),this.emit("restart",this._object)},W.prototype.seek=function(t,e){return this._startTime=q()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this._object),e?this:this.pause()},W.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},W.prototype.to=function(t,e){var i=this;if(void 0===t&&(t={}),void 0===e&&(e=1e3),"number"==typeof t){var r={Number:t};this._valuesEnd=r}else"string"==typeof t&&this.isJoinToString?this._valuesEnd=X(this.object,t.match(Z).map(n)):this._valuesEnd=t;if("number"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var o in e)i[o]&&(a=i)[o].apply(a,Array.isArray(e)?e:[e]);return this;var a},W.prototype.render=function(){var t=this,i=this,r=(i._startTime,i._delayTime,i._valuesEnd),o=(i._valuesStart,i.object);if("object"==typeof r)for(var a in r){if("object"==typeof r[a]&&r[a])t._valuesEnd[a]=X(o[a],r[a]),t.object[a]=t._valuesEnd[a](0);else if("string"==typeof r[a]&&"string"==typeof o[a]&&Z.test(o[a])&&Z.test(r[a])){var s=o[a].match(Z);s=s.map(n);var u=r[a].match(Z);u=u.map(n),t._valuesEnd[a]=X(s,u),t._valuesEnd[a].join=!0,t.object[a]=e(t._valuesEnd[a](0))}W.checkValidness(o[a])!==!1&&o[a]!==r[a]&&(t._valuesStart[a]=o[a])}},W.prototype.start=function(t){return this._startTime=void 0!==t?t:q(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,P(this),this.emit("start",this.object),this._isPlaying=!0,this},W.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object;return e?(k(this),this._isPlaying=!1,this.emit("stop",n)):this},W.prototype.end=function(){var t=this,e=t._startTime,n=t._duration;return this.update(e+n)},W.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this._startTime+=this._delayTime,this},W.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this},W.prototype.repeatDelay=function(t){return this._repeatDelayTime="function"==typeof t?t(this._repeatDelayTime):t,this},W.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},W.prototype.yoyo=function(t){return this._yoyo="function"==typeof t?t(this._yoyo):t,this},W.prototype.easing=function(t){return this._easingFunction=t,this},W.prototype.interpolation=function(t){return this._interpolationFunction=t,this},W.prototype.get=function(t){return this.update(t),this.object},W.prototype.update=function(t){var n,i,r,o=this,a=this,s=a._onStartCallbackFired,u=a._easingFunction,f=a._interpolationFunction,h=a._repeat,p=a._repeatDelayTime,c=a._reverseDelayTime,l=(a._delayTime,a._yoyo),d=a._reversed,v=a._startTime,y=a._duration,m=a._valuesStart,_=a._valuesEnd,g=a.object,b=a.isJoinToString;if(t=void 0!==t?t:q(),t<v)return!0;if(s||(this._rendered||(this.render(),this.emit("start",g),this._rendered=!0),this._onStartCallbackFired=!0),i=(t-v)/y,i=i>1?1:i,i=d?1-i:i,r="function"==typeof u?u(i):V(i),"function"==typeof _){var T=_(i);b&&(T=e(T)),this.emit("update",T,r,i)}else{for(n in _)if(void 0!==m[n]){var w=m[n],O=_[n];if(r=u[n]?u[n](i):r,"function"==typeof O){var M=O(r);O.join&&(M=e(M)),g[n]=M}else Array.isArray(O)?g[n]=f(O,r):"string"==typeof O?(O="+"===O.charAt(0)||"-"===O.charAt(0)?w+parseFloat(O):parseFloat(O),"number"==typeof O&&(g[n]=((w+(O-w)*r)*Q|0)/Q)):"number"==typeof w&&(g[n]=((w+(O-w)*r)*Q|0)/Q)}this.emit("update",g,r,i)}if(1===i||d&&0===i){if(h){isFinite(h)&&this._repeat--;for(n in _)"string"==typeof _[n]&&"number"==typeof m[n]&&(o._valuesStart[n]=m[n]+parseFloat(_[n]));return this.emit(d?"reverse":"repeat",g),l&&(this._reversed=!d),!d&&p?this._startTime+=y+p:d&&c?this._startTime+=y+c:this._startTime+=y,!0}return this.emit("complete",g),this._repeat=this._r,!1}return!0};var G={filter:{grayscale:1,brightness:1,sepia:1,invert:1,saturate:1,contrast:1,blur:1,hueRotate:1,dropShadow:1},transform:{translate:1,translateX:1,translateY:1,translateZ:1,rotate:1,rotateX:1,rotateY:1,rotateZ:1,scale:1,scaleX:1,scaleY:1,scaleZ:1,skew:1,skewX:1,skewY:1,x:1,y:1,z:1},color:{fill:1,stroke:1,color:1,backgroundColor:1,borderColor:1,outlineColor:1}},H=function(){};H.Attr=function(t){var e=this.domNode;return{update:function(t,n){for(var i in n)G.transform[i]||G.filter[i]||e.setAttribute(i,n[i])}}},H.Color=function(t){var e=this.domNode,n=/\.([0-9]+)/g;return{update:function(t,i){for(var r in i)G.color[r]&&(e.style[r]=i[r].replace(n,""))}}},H.Style=function(){var t=this.domNode,e=t.style;return{update:function(t,n){for(var i in n)G.transform[i]||G.filter[i]||(e[i]=n[i])}}},H.Transform=function(){var t=this.domNode,e=t.style;return{update:function(t,n){var i="";for(var r in n)G.filter[r]||("x"===r||"y"===r||"z"===r?i+=" translate3d( "+(n.x||"0px")+", "+(n.y||"0px")+", "+(n.z||"0px")+")":G.transform[r]&&(i+=" "+r+"( "+n[r]+")"));i&&(e.transform=i)}}},H.SVGTransform=function(t,e){var n=this.domNode,i={};return{update:function(r,o){var a=this,s="";for(var u in o)G.transform[u]&&(void 0!==i.x&&void 0!==i.y?s+="rotate"===u?" rotate("+o[u]+" "+i.x+" "+i.y+")":"x"===u||"y"===u?" translate("+(o.x||0)+", "+(o.y||0)+")":" "+u+"("+o[u]+")":a.setOrigin(t,e));return s&&n.setAttribute("transform",s),this},init:function(n,i){return this.setOrigin(t,e)},setOrigin:function(t,e){var r=n.getBoundingClientRect(),o=r.width,a=r.height,s=r.left,u=r.top;return t="number"==typeof t?s+t:"string"==typeof t&&t.indexOf("%")>-1?s+o*(parseFloat(t)/100):s+o/2,e="number"==typeof e?s+e:"string"==typeof e&&e.indexOf("%")>-1?u+a*(parseFloat(e)/100):u+a/2,void 0!==i.x&&void 0!==i.y&&(t+=t-diffX,e+=e-diffY),i.x=t,i.y=e,this}}},H.Filter=function(){var t=this.domNode,e=t.style;return{update:function(t,n){var i="";for(var r in n)G.transform[r]||G.filter[r]&&(i+=" "+r+"( "+n[r]+")");i&&(e.webkitFilter=e.filter=i)}}},H.Scroll=function(){var t=this.domNode;return{update:function(e,n){for(var i in n)t[i]=n[i]}}};var K=function(t){return this.domNode=t,this.plugins={},this.map=this.map.bind(this),this.render=this.render.bind(this),this.init=this.init.bind(this),this.fetch=this.fetch.bind(this),this};K.prototype.map=function(t,e){var n=this,i=this,r=i.plugins;for(var o in r){var a=r[o];a&&a[t]&&a[t](n,e)}return this},K.prototype.render=function(t){return this.map("update",t)},K.prototype.init=function(t){return this.map("init",t)},K.prototype.fetch=function(t){return this.map("fetch",fetch)},K.prototype.applyPlugin=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return void 0!==H[t]?(this.plugins[t]=H[t].apply(this,e),this.plugins[t]):this},K.prototype.appendTo=function(t){return t.appendChild(this.domNode),this};var $=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=q(),this._tweens={},this._elapsed=0,this._id=x(),this._labels={},this._defaultParams=e,this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setLabel=function(t,e){return this._labels[t]=this.parsePosition(0,e,0),this},e.prototype.parsePosition=function(t,e,n){var i=this,r=t+n;if("string"==typeof e){for(var o in i._labels)if(0===e.indexOf(o)){var a=e.split(o)[1];0!==a.length&&"+"!==a[0]&&"-"!==a[0]||(r=i._labels[o]+t,e=e.replace(o,""))}0!==e.indexOf("+")&&0!==e.indexOf("-")||(r+=parseFloat(e))}else"number"==typeof e&&(r+=e);return r},e.prototype.map=function(t){var e=this;for(var n in e._tweens)t(e._tweens[n]);return this},e.prototype.add=function(e,n){"object"!=typeof e||e instanceof t||(e=new t(e.from,tweens));var i=this,r=i._defaultParams,o=i._totalDuration;if(r)for(var a in r)e[a](r[a]);return e._startTime=this.parsePosition(0,n,o),e._startTime+=q(),this._totalDuration=Math.max(o,e._duration+e._startTime),this._tweens[e.id]=e,this},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=this,i=n._tweens,r=n._totalDuration,o=n._repeatDelayTime,a=n._reverseDelayTime,s=n._startTime,u=n._reversed,f=n._yoyo,h=n._repeat;if(t<s)return!0;var p=Math.min(1,Math.max(0,(t-s)/r));p=u?1-p:p,this._elapsed=p;var c=t-s;c=u?r-c:c;for(var l in i)i[l].update(c)||delete e._tweens[l];return this.emit("update",p),!(1===p||u&&0===p)||(h?(isFinite(h)&&this._repeat--,this.emit(u?"reverse":"repeat"),f&&(this._reversed=!u),!u&&o?this._startTime+=r+o:u&&a?this._startTime+=r+a:this._startTime+=r,!0):(this.emit("complete"),this._repeat=this._r,!1))},e.prototype.elapsed=function(t){return void 0!==t?this.update(t*this._totalDuration):this._elapsed},e}(W),tt=function(t){return t};t.TweenInit=i,t.nextId=x,t.has=D,t.get=N,t.getAll=E,t.removeAll=C,t.remove=k,t.add=P,t.now=q,t.update=B,t.autoPlay=S,t.on=F,t.once=I,t.off=A,t.emit=j,t.Tween=W,t.Easing=J,t.Interpolation=U,t.Composite=K,t.Timeline=$,t.Plugins=H,t.PropertyTypes=G,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=t.TWEEN||{})}(this,function(t){"use strict";function e(t){for(var e="",n=0,i=t.length;n<i;n++)e+=t[n];return e}function n(t){var e=parseFloat(t);return"number"!=typeof e||isNaN(e)?t:e}function i(t){var e=t.from,n=t.to,i=t.duration;void 0===i&&(i=1e3);var r=t.easing;void 0===r&&(r=tt);var o=t.events,a=t.instance,s=new W(e,a).to(n,i).easing(tt);o&&(s._events=o),t.start=s.start.bind(s)}void 0===Object.assign&&(Object.assign=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return e.map(function(e){for(var n in e)t[n]=e[n]}),t});var r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof t?t:{},o=["webkit","moz","ms","o"],a="AnimationFrame",s="Request"+a,u="Cancel"+a,f="CancelRequest"+a,h=r.setTimeout,p=r.clearTimeout;if(h&&void 0===r.requestAnimationFrame){var c,l,d=Date.now(),v=50/3,y=v;o.map(function(t){void 0===(c=r[t+s])&&(c=function(t){return h(function(){l=Date.now(),t(l-d),y=v+(Date.now()-l)},y)})}),void 0!==c&&(r.requestAnimationFrame=c)}if(p&&void 0===r.cancelAnimationFrame&&void 0===(r.cancelAnimationFrame=r.cancelRequestAnimationFrame)){var m;o.map(function(t){void 0===(m=r[t+u])&&void 0===(m=r[t+f])&&(m=function(t){return p(t)})}),void 0!==m&&(r.cancelAnimationFrame=m)}void 0===Array.isArray&&(Array.isArray=function(t){return void 0!==t&&"object"==typeof t&&t.length&&void 0!==t.push&&void 0!==t.splice});var _,g={},b=!1,T=!1,w={},O="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},M=0;Object.defineProperty(g,"length",{enumerable:!1,writable:!0,value:0});var j=function(t,e,n,i,r,o){var a=this,s=w[t];if(s)for(var u=s.length;u--;)s[u].call(a,e,n,i,r,o)},F=function(t,e){void 0===w[t]&&(w[t]=[]),w[t].push(e)},I=function(t,e){void 0===w[t]&&(w[t]=[]),F(t,function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];e.apply(void 0,n),A(t)})},A=function(t,e){if(void 0!==t&&void 0!==w[t])if(void 0!==e)for(var n=w[name],i=0;i<n.length;)n[i]===e&&n.splice(i,1),i++;else w[name]=[]},P=function(t){var e=t.id;g[e]=t,g.length++,T&&!b&&(B(),b=!0,j("start")),j("add",t,g)},x=function(){var t=M;return M++,t},S=function(){return g},C=function(t){T=t},E=function(){g={},Object.defineProperty(g,"length",{enumerable:!1,writable:!0,value:0})},N=function(t){for(var e in g)if(t.id===+e)return g[+e];return null},k=function(t){return null!==N(t)},D=function(t){for(var e in g)t.id===+e&&(delete g[+e],g.length--)},q=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}}(),B=function(t,e){if(t=void 0!==t?t:q(),T&&(_=requestAnimationFrame(B)),j("update",t,g),0===g.length)return b=!1,cancelAnimationFrame(_),j("stop",t),!1;for(var n in g)g[n].update(t)||e?n++:(delete g[+n],g.length--);return!0};if(O.document){var L=O.document,R=0,z=0;L.addEventListener("visibilitychange",function(t){if(0===g.length)return!1;if(document.hidden)z=q();else{R=q()-z;for(var e in g)g[e]._startTime+=R}return!0})}var J={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*(-Math.pow(2,-10*(t-1))+2)}},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,t<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?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-J.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*J.Bounce.In(2*t):.5*J.Bounce.Out(2*t-1)+.5}}},U={Linear:function(t,e){var n=t.length-1,i=n*e,r=Math.floor(i),o=U.Utils.Linear;return e<0?o(t[0],t[1],i):e>1?o(t[n],t[n-1],n-i):o(t[r],t[r+1>n?n:r+1],i-r)},Bezier:function(t,e){for(var n=0,i=t.length-1,r=Math.pow,o=U.Utils.Bernstein,a=0;a<=i;a++)n+=r(1-e,i-a)*r(e,a)*t[a]*o(i,a);return n},CatmullRom:function(t,e){var n=t.length-1,i=n*e,r=Math.floor(i),o=U.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(r=Math.floor(i=n*(1+e))),o(t[(r-1+n)%n],t[r],t[(r+1)%n],t[(r+2)%n],i-r)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-i)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],i-n)-t[n]):o(t[r?r-1:0],t[r],t[n<r+1?n:r+1],t[n<r+2?n:r+2],i-r)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=U.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 i=e;i>1;i--)n*=i;return t[e]=n,n}}(),CatmullRom:function(t,e,n,i,r){var o=.5*(n-t),a=.5*(i-e),s=r*r,u=r*s;return(2*e-2*n+o+a)*u+(-3*e+3*n-2*o-a)*s+o*r+e}}},X=function(t,e,n){if(void 0===n&&(n=1e4),Array.isArray(t)){e=e.map(function(e,n){return e===t[n]?null:"number"==typeof e?e-t[n]:"string"==typeof e?e:X(t[n],e)});var i=[].concat(t);return function(r){for(var o=0,a=e.length;o<a;o++){var s=e[o];"function"==typeof s?i[o]=s(r):"number"==typeof s&&(i[o]=((t[o]+s*r)*n|0)/n)}return i}}if("object"==typeof t){for(var r in e)e[r]===t[r]?e[r]=null:"object"==typeof e[r]?e[r]=X(t[r],e[r]):"number"==typeof t[r]&&(e[r]-=t[r]);var o=Object.assign({},t);return function(i){for(var r in e){var a=e[r];"function"==typeof a?o[r]=a(i):"number"==typeof a&&(o[r]=((t[r]+a*i)*n|0)/n)}return o}}if("number"==typeof t){e-=t;var a=t===e;return function(i){return a?e:((t+e*i)*n|0)/n}}var s=t===e;return function(n){return s?t:n>=.5?e:t}},Y={add:function(t){return Y[t]&&JSON.stringify(t)&&JSON.stringify(Y[t])?Y[t]:(Y[t]=t,t)}},Z=/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi,Q=1e4,V=J.Linear.None,W=function t(e,i){return void 0===e&&(e={}),this.isJoinToString="string"==typeof e&&Z.test(e),e=this.isJoinToString?e.match(Z).map(n):e,this.object=e,this._valuesStart=t.createEmptyConst(e),this._valuesEnd=t.createEmptyConst(e),this._duration=1e3,this._easingFunction=V,this._interpolationFunction=U.None,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.id=x(),i&&i.to?new t(e).to(i.to,i):this};W.createEmptyConst=function(t){return"number"==typeof t?0:Array.isArray(t)?[]:"object"==typeof t?{}:""},W.checkValidness=function(t){return void 0!==t&&null!==t&&""!==t&&NaN!==t&&t!==1/0},W.prototype.isPlaying=function(){return this._isPlaying},W.prototype.isStarted=function(){return this._onStartCallbackFired},W.prototype.reverse=function(){var t=this,e=t._reversed;return this._reversed=!e,this},W.prototype.reversed=function(){return this._reversed},W.prototype.useActiveMode=function(){return this.object=Y.add(this.object),this},W.prototype.off=function(t,e){if(!this._events||void 0===this._events[t])return this;if(void 0!==t&&void 0!==e)for(var n=this._events[t],i=0;i<n.length;)n[i]===e&&n.splice(i,1),i++;else void 0!==t&&void 0===e&&(this._events[t]=[]);return this},W.prototype.on=function(t,e){return this._events&&void 0!==this._events[t]||(this._events||(this._events={}),this._events[t]=[]),this._events[t].push(e),this},W.prototype.once=function(t,e){var n=this;return this._events&&void 0!==this._events[t]||(this._events||(this._events={}),this._events[t]=[]),this.on(t,function(){for(var i=[],r=arguments.length;r--;)i[r]=arguments[r];e.call.apply(e,[n].concat(i)),n.off(t)})},W.prototype.emit=function(t,e,n,i,r,o){var a=this,s=this,u=s._events;if(!u)return this;var f=u[t];if(!f)return this;for(var h=f.length;h--;)f[h].call(a,e,n,i,r,o);return this},W.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,D(this),this._pausedTime=q(),this.emit("pause",this.object)):this},W.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=q()-this._pausedTime,P(this),this._pausedTime=q(),this.emit("play",this.object))},W.prototype.restart=function(t){return this._repeat=this._r,this._startTime=q()+(t?0:this._delayTime),this._isPlaying||P(this),this.emit("restart",this._object)},W.prototype.seek=function(t,e){return this._startTime=q()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this._object),e?this:this.pause()},W.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},W.prototype.to=function(t,e){var i=this;if(void 0===t&&(t={}),void 0===e&&(e=1e3),"number"==typeof t){var r={Number:t};this._valuesEnd=r}else"string"==typeof t&&this.isJoinToString?this._valuesEnd=X(this.object,t.match(Z).map(n)):this._valuesEnd=t;if("number"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var o in e)i[o]&&(a=i)[o].apply(a,Array.isArray(e)?e:[e]);return this;var a},W.prototype.render=function(){var t=this,i=this,r=(i._startTime,i._delayTime,i._valuesEnd),o=(i._valuesStart,i.object);if("object"==typeof r)for(var a in r){if("object"==typeof r[a]&&r[a])t._valuesEnd[a]=X(o[a],r[a]),t.object[a]=t._valuesEnd[a](0);else if("string"==typeof r[a]&&"string"==typeof o[a]&&Z.test(o[a])&&Z.test(r[a])){var s=o[a].match(Z);s=s.map(n);var u=r[a].match(Z);u=u.map(n),t._valuesEnd[a]=X(s,u),t._valuesEnd[a].join=!0,t.object[a]=e(t._valuesEnd[a](0))}W.checkValidness(o[a])!==!1&&o[a]!==r[a]&&(t._valuesStart[a]=o[a])}},W.prototype.start=function(t){return this._startTime=void 0!==t?t:q(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,P(this),this.emit("start",this.object),this._isPlaying=!0,this},W.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object;return e?(D(this),this._isPlaying=!1,this.emit("stop",n)):this},W.prototype.end=function(){var t=this,e=t._startTime,n=t._duration;return this.update(e+n)},W.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this._startTime+=this._delayTime,this},W.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this},W.prototype.repeatDelay=function(t){return this._repeatDelayTime="function"==typeof t?t(this._repeatDelayTime):t,this},W.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},W.prototype.yoyo=function(t){return this._yoyo="function"==typeof t?t(this._yoyo):t,this},W.prototype.easing=function(t){return this._easingFunction=t,this},W.prototype.interpolation=function(t){return this._interpolationFunction=t,this},W.prototype.get=function(t){return this.update(t),this.object},W.prototype.update=function(t){var n,i,r,o=this,a=this,s=a._onStartCallbackFired,u=a._easingFunction,f=a._interpolationFunction,h=a._repeat,p=a._repeatDelayTime,c=a._reverseDelayTime,l=(a._delayTime,a._yoyo),d=a._reversed,v=a._startTime,y=a._duration,m=a._valuesStart,_=a._valuesEnd,g=a.object,b=a.isJoinToString;if(t=void 0!==t?t:q(),t<v)return!0;if(s||(this._rendered||(this.render(),this.emit("start",g),this._rendered=!0),this._onStartCallbackFired=!0),i=(t-v)/y,i=i>1?1:i,i=d?1-i:i,r="function"==typeof u?u(i):V(i),"function"==typeof _){var T=_(i);b&&(T=e(T)),this.emit("update",T,r,i)}else{for(n in _)if(void 0!==m[n]){var w=m[n],O=_[n];if(r=u[n]?u[n](i):r,"function"==typeof O){var M=O(r);O.join&&(M=e(M)),g[n]=M}else Array.isArray(O)?g[n]=f(O,r):"string"==typeof O?(O="+"===O.charAt(0)||"-"===O.charAt(0)?w+parseFloat(O):parseFloat(O),"number"==typeof O&&(g[n]=((w+(O-w)*r)*Q|0)/Q)):"number"==typeof w&&(g[n]=((w+(O-w)*r)*Q|0)/Q)}this.emit("update",g,r,i)}if(1===i||d&&0===i){if(h){isFinite(h)&&this._repeat--;for(n in _)"string"==typeof _[n]&&"number"==typeof m[n]&&(o._valuesStart[n]=m[n]+parseFloat(_[n]));return this.emit(d?"reverse":"repeat",g),l&&(this._reversed=!d),!d&&p?this._startTime+=y+p:d&&c?this._startTime+=y+c:this._startTime+=y,!0}return this.emit("complete",g),this._repeat=this._r,!1}return!0};var G={filter:{grayscale:1,brightness:1,sepia:1,invert:1,saturate:1,contrast:1,blur:1,hueRotate:1,dropShadow:1},transform:{translate:1,translateX:1,translateY:1,translateZ:1,rotate:1,rotateX:1,rotateY:1,rotateZ:1,scale:1,scaleX:1,scaleY:1,scaleZ:1,skew:1,skewX:1,skewY:1,x:1,y:1,z:1},color:{fill:1,stroke:1,color:1,backgroundColor:1,borderColor:1,outlineColor:1,boxShadowColor:1,textShadowColor:1},scroll:{scrollTop:1,scrollLeft:1}},H=function(){};H.Attr=function(t){var e=this.domNode;return{update:function(t,n){for(var i in t)G.transform[i]||G.filter[i]||G.color[i]||G.scroll[i]||e.setAttribute(i,t[i])}}},H.Color=function(t){var e=this.domNode,n=e.style,i=/\.([0-9]+)/g,r="";return{update:function(t){for(var e in t)G.color[e]&&(n[e]=t[e].replace(i,r))}}},H.Style=function(){var t=this.domNode,e=t.style;return{update:function(t){for(var n in t)G.transform[n]||G.filter[n]||G.color[n]||(e[n]=t[n])}}},H.Transform=function(){var t=this.domNode,e=t.style;return{update:function(t){var n="";for(var i in t)G.transform[i]&&("x"===i||"y"===i||"z"===i?n+=" translate3d( "+(t.x||"0px")+", "+(t.y||"0px")+", "+(t.z||"0px")+")":G.transform[i]&&(n+=" "+i+"( "+t[i]+")"));n&&(e.transform=n)}}},H.SVGTransform=function(t,e){var n,i=this.domNode,r={},o="transform",a="rotate",s="x",u="y";return n={update:function(f){var h="";for(var p in f)G[o][p]&&(void 0!==r.x&&void 0!==r.y?h+=p===a?" rotate("+f[p]+" "+r.x+" "+r.y+")":p===s||p===u?" translate("+(f.x||0)+", "+(f.y||0)+")":" "+p+"("+f[p]+")":n.setOrigin(t,e));return h&&i.setAttribute(o,h),n},init:function(i,r){return n.setOrigin(t,e)},setOrigin:function(t,e){var o=i.getBoundingClientRect(),a=o.width,s=o.height,u=o.left,f=o.top;return t="number"==typeof t?u+t:"string"==typeof t&&t.indexOf("%")>-1?u+a*(parseFloat(t)/100):u+a/2,e="number"==typeof e?u+e:"string"==typeof e&&e.indexOf("%")>-1?f+s*(parseFloat(e)/100):f+s/2,void 0!==r.x&&void 0!==r.y&&(t+=t-diffX,e+=e-diffY),r.x=t,r.y=e,n}}},H.Filter=function(){var t=this.domNode,e=t.style;return{update:function(t){var n="";for(var i in t)G.filter[i]&&G.filter[i]&&(n+=" "+i+"( "+t[i]+")");n&&(e.webkitFilter=e.filter=n)}}},H.Scroll=function(){var t=this.domNode;return{update:function(e){for(var n in e)G.scroll[n]&&(t[n]=e[n])}}};var K=function(t){return this.domNode=t,this.plugins={},this.map=this.map.bind(this),this.render=this.render.bind(this),this.init=this.init.bind(this),this.fetch=this.fetch.bind(this),this};K.prototype.map=function(t){for(var e=this,n=[],i=arguments.length-1;i-- >0;)n[i]=arguments[i+1];var r=this,o=r.plugins;for(var a in o){var s=o[a];s&&s[t]&&s[t].apply(e,n)}return this},K.prototype.render=function(t,e,n){return this.map("update",t,e,n)},K.prototype.init=function(t){return this.map("init",t)},K.prototype.fetch=function(t){return this.map("fetch",fetch)},K.prototype.applyPlugin=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return void 0!==H[t]?(this.plugins[t]=H[t].apply(this,e),this.plugins[t]):this},K.prototype.appendTo=function(t){return t.appendChild(this.domNode),this};var $=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=q(),this._tweens={},this._elapsed=0,this._id=x(),this._labels={},this._defaultParams=e,this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setLabel=function(t,e){return this._labels[t]=this.parsePosition(0,e,0),this},e.prototype.parsePosition=function(t,e,n){var i=this,r=t+n;if("string"==typeof e){for(var o in i._labels)if(0===e.indexOf(o)){var a=e.split(o)[1];0!==a.length&&"+"!==a[0]&&"-"!==a[0]||(r=i._labels[o]+t,e=e.replace(o,""))}0!==e.indexOf("+")&&0!==e.indexOf("-")||(r+=parseFloat(e))}else"number"==typeof e&&(r+=e);return r},e.prototype.map=function(t){var e=this;for(var n in e._tweens)t(e._tweens[n]);return this},e.prototype.add=function(e,n){"object"!=typeof e||e instanceof t||(e=new t(e.from,tweens));var i=this,r=i._defaultParams,o=i._totalDuration;if(r)for(var a in r)e[a](r[a]);return e._startTime=this.parsePosition(0,n,o),e._startTime+=q(),this._totalDuration=Math.max(o,e._duration+e._startTime),this._tweens[e.id]=e,this},e.prototype.restart=function(){return this._startTime+=q(),add(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,i=e._totalDuration,r=e._repeatDelayTime,o=e._reverseDelayTime,a=e._startTime,s=e._reversed,u=e._yoyo,f=e._repeat;if(t<a)return!0;var h=Math.min(1,Math.max(0,(t-a)/i));h=s?1-h:h,this._elapsed=h;var p=t-a,c=s?i-p:p;for(var l in n){var d=n[l];d.skip||d.update(c)||(d.skip=!0)}if(this.emit("update",h,p),1===h||s&&0===h){if(f){isFinite(f)&&this._repeat--,this.emit(s?"reverse":"repeat"),u&&(this._reversed=!s),!s&&r?this._startTime+=i+r:s&&o?this._startTime+=i+o:this._startTime+=i;for(var v in n){var y=n[v];y.skip&&(y.skip=!1)}return!0}return this.emit("complete"),this._repeat=this._r,!1}return!0},e.prototype.elapsed=function(t){return void 0!==t?this.update(t*this._totalDuration):this._elapsed},e}(W),tt=function(t){return t};t.TweenInit=i,t.nextId=x,t.has=k,t.get=N,t.getAll=S,t.removeAll=E,t.remove=D,t.add=P,t.now=q,t.update=B,t.autoPlay=C,t.on=F,t.once=I,t.off=A,t.emit=j,t.Tween=W,t.Easing=J,t.Interpolation=U,t.Composite=K,t.Timeline=$,t.Plugins=H,t.PropertyTypes=G,Object.defineProperty(t,"__esModule",{value:!0})});

@@ -9,3 +9,3 @@ {

"name": "es6-tween",
"version": "2.4.0",
"version": "2.4.1",
"description": "ES6 implementation of amazing tween.js",

@@ -12,0 +12,0 @@ "browser": "dist/Tween.min.js",

@@ -18,3 +18,3 @@ import Plugins from './Plugins';

}
map (type, object) {
map (type, ...args) {

@@ -27,3 +27,3 @@ let { plugins } = this;

plugin && plugin[type] && plugin[type](this, object);
plugin && plugin[type] && plugin[type].apply(this, args);

@@ -34,5 +34,5 @@ }

}
render (object) {
render (object, value, elapsed) {
return this.map('update', object);
return this.map('update', object, value, elapsed);

@@ -39,0 +39,0 @@ }

@@ -39,3 +39,9 @@ const cache = {

borderColor : 1,
outlineColor: 1
outlineColor: 1,
boxShadowColor: 1,
textShadowColor: 1
},
scroll: {
scrollTop: 1,
scrollLeft: 1
}

@@ -50,5 +56,5 @@ };

return {
update(Tween, RenderObject) {
update(RenderObject, value) {
for (let p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) continue;
if (cache.transform[p] || cache.filter[p] || cache.color[p] || cache.scroll[p]) continue;
layer.setAttribute(p, RenderObject[p]);

@@ -60,9 +66,10 @@ }

static Color(Composite) {
let layer = this.domNode
let decimalRegExp = /\.([0-9]+)/g;
let layer = this.domNode;
let style = layer.style;
let decimalRegExp = /\.([0-9]+)/g, replaceTo = '';
return {
update(Tween, RenderObject) {
update(RenderObject) {
for (let p in RenderObject) {
if (!cache.color[p]) continue;
layer.style[p] = RenderObject[p].replace(decimalRegExp, '');
style[p] = RenderObject[p].replace(decimalRegExp, replaceTo);
}

@@ -76,5 +83,5 @@ }

return {
update(Tween, RenderObject) {
update(RenderObject) {
for (let p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) continue;
if (cache.transform[p] || cache.filter[p] || cache.color[p]) continue;
style[p] = RenderObject[p];

@@ -89,6 +96,6 @@ }

return {
update(Tween, RenderObject) {
update(RenderObject) {
let transform = '';
for (let p in RenderObject) {
if (cache.filter[p]) continue;
if (!cache.transform[p]) continue;
if (p === 'x' || p === 'y' || p === 'z') {

@@ -108,15 +115,16 @@ transform += ' translate3d( ' + (RenderObject.x || '0px') + ', ' + (RenderObject.y || '0px') + ', ' + (RenderObject.z || '0px') + ')';

let layer = this.domNode,
bbox = {};
return {
update(Tween, RenderObject) {
bbox = {}, self;
let attrName = 'transform', rotate = 'rotate', x = 'x', y = 'y';
return self = {
update(RenderObject) {
let transform = '';
for (let p in RenderObject) {
if (!cache.transform[p]) continue;
if (!cache[attrName][p]) continue;
if (bbox.x === undefined || bbox.y === undefined) {
this.setOrigin(xPos, yPos);
self.setOrigin(xPos, yPos);
continue;
}
if (p === 'rotate') {
if (p === rotate) {
transform += ` rotate(${RenderObject[p]} ${bbox.x} ${bbox.y})`;
} else if (p === 'x' || p === 'y') {
} else if (p === x || p === y) {
transform += ` translate(${RenderObject.x || 0}, ${RenderObject.y || 0})`;

@@ -128,9 +136,9 @@ } else {

if (transform) {
layer.setAttribute('transform', transform)
layer.setAttribute(attrName, transform)
}
return this;
return self;
},
init(Tween, RenderObject) {
return this.setOrigin(xPos, yPos);
return self.setOrigin(xPos, yPos);

@@ -155,3 +163,3 @@ },

return this;
return self;
}

@@ -164,6 +172,6 @@ }

return {
update(Tween, RenderObject) {
update(RenderObject) {
let filter = '';
for (let p in RenderObject) {
if (cache.transform[p]) continue;
if (!cache.filter[p]) continue;
if (cache.filter[p]) {

@@ -182,4 +190,5 @@ filter += ` ${ p }( ${ RenderObject[p] })`;

return {
update: (Tween, RenderObject) => {
update: (RenderObject) => {
for (let p in RenderObject) {
if (!cache.scroll[p]) continue;
layer[p] = RenderObject[p];

@@ -186,0 +195,0 @@ }

@@ -88,2 +88,9 @@ import Tween from './Tween';

}
restart () {
this._startTime += now();
add(this);
return this.emit('restart');
}
easing(easing) {

@@ -118,13 +125,14 @@ return this.map(tween => tween.easing(easing));

let timing = time - _startTime;
timing = _reversed ? _totalDuration - timing : timing;
let _timing = _reversed ? _totalDuration - timing : timing;
for (let tween in _tweens) {
if (_tweens[tween].update(timing)) {
let _tween = _tweens[tween];
if (_tween.skip || _tween.update(_timing)) {
continue;
} else {
delete this._tweens[tween];
}
_tween.skip = true;
}
}
this.emit('update', elapsed);
this.emit('update', elapsed, timing);

@@ -153,2 +161,9 @@ if (elapsed === 1 || (_reversed && elapsed === 0)) {

}
for (let tween in _tweens) {
let _tween = _tweens[tween];
if (_tween.skip) {
_tween.skip = false;
}
}

@@ -155,0 +170,0 @@ return true;

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