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.1 to 2.5.0

133

dist/Tween.js

@@ -730,10 +730,2 @@ (function (global, factory) {

function joinToString (__array__like) {
var str = '';
for ( var i = 0, len = __array__like.length; i < len; i++ ) {
str += __array__like[i];
}
return str;
}
function toNumber(val) {

@@ -744,2 +736,27 @@ var floatedVal = parseFloat(val);

var colorMatch = /rgb|hsl|hsv/g;
var isIncrementReqForColor = /ahsv|ahsl|argb/g;
// Credits:
// @jkroso for string parse library
// Optimized, Extended by @dalisoft
var Number_Match_RegEx =
/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi;
var hexColor = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i;
var hexReplace = function (all, hex) {
var r;
var g;
var b;
if (hex.length === 3) {
r = parseInt(hex[0] + hex[0], 16);
g = parseInt(hex[1] + hex[1], 16);
b = parseInt(hex[2] + hex[2], 16);
} else if (hex.length === 6) {
r = parseInt(hex.substr(0, 2), 16);
g = parseInt(hex.substr(2, 2), 16);
b = parseInt(hex.substr(4, 6), 16);
}
return ("rgb(" + r + "," + g + "," + b);
};
var SubTween = function (start, end, roundv) {

@@ -749,3 +766,10 @@ if ( roundv === void 0 ) roundv = 10000;

if (Array.isArray(start)) {
end = end.map(function (v, i) { return v === start[i] ? null : typeof v === "number" ? v - start[i] : typeof v === "string" ? v : SubTween(start[i], v); });
var isColorPropsExist = null;
var startIndex = null;
end = end.map(function (v, i) { return colorMatch.test(v) ? (isColorPropsExist = v, startIndex = i, null) : v === start[i] ? null : typeof v === "number" ? v - start[i] : typeof v === "string" ? v : SubTween(start[i], v); });
var endIndex = startIndex !== null ? startIndex + 6 : null;
if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {
startIndex++;
endIndex++;
}
var map = [].concat( start );

@@ -759,3 +783,8 @@ return function (t) {

map[i] = (((start[i] + v * t) * roundv) | 0) / roundv;
if (startIndex !== null && i > startIndex && i < endIndex) {
map[i] = map[i] | 0;
}
}
}

@@ -792,2 +821,16 @@ return map;

}
} else if (typeof start === "string") {
var _startMap = start.replace(hexColor, hexReplace).match(Number_Match_RegEx).map(toNumber);
var _endMap = end.replace(hexColor, hexReplace).match(Number_Match_RegEx).map(toNumber);
var _tween = SubTween(_startMap, _endMap);
return function (t) {
var _t = _tween(t);
var i = 0;
var s = '';
while (i < _t.length) {
s += _t[i];
i++;
}
return s
}
} else {

@@ -809,8 +852,2 @@ var isSame$1 = start === end;

// Credits:
// @jkroso for string parse library
// Optimized, Extended by @dalisoft
var Number_Match_RegEx =
/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi;
var maxDecNum = 10000;

@@ -823,5 +860,3 @@ var defaultEasing = Easing.Linear.None;

this.isJoinToString = typeof object === "string" && Number_Match_RegEx.test(object);
object = this.isJoinToString ? object.match(Number_Match_RegEx)
.map(toNumber) : object;
this.isJoinToString = typeof object === "string";
this.object = object;

@@ -1022,3 +1057,3 @@ this._valuesStart = Tween.createEmptyConst(object);

} else if (typeof properties === "string" && this.isJoinToString) {
this._valuesEnd = SubTween(this.object, properties.match(Number_Match_RegEx).map(toNumber));
this._valuesEnd = SubTween(this.object, properties);
} else {

@@ -1062,14 +1097,7 @@ this._valuesEnd = properties;

} else if (typeof _valuesEnd[property] === "string" && typeof object[property] === "string" &&
Number_Match_RegEx.test(object[property]) && Number_Match_RegEx.test(_valuesEnd[property])) {
} else if (typeof _valuesEnd[property] === "string" && typeof object[property] === "string") {
var _get__Start = object[property].match(Number_Match_RegEx);
_get__Start = _get__Start.map(toNumber);
var _get__End = _valuesEnd[property].match(Number_Match_RegEx);
_get__End = _get__End.map(toNumber);
this$1._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
this$1.object[property] = this$1._valuesEnd[property](0);
this$1._valuesEnd[property] = SubTween(_get__Start, _get__End);
this$1._valuesEnd[property].join = true;
this$1.object[property] = joinToString(this$1._valuesEnd[property](0));
}

@@ -1247,12 +1275,4 @@

var get$$1 = _valuesEnd(elapsed);
this.emit('update', _valuesEnd(elapsed), value, elapsed);
if (isJoinToString) {
get$$1 = joinToString(get$$1);
}
this.emit('update', get$$1, value, elapsed);
} else {

@@ -1273,12 +1293,4 @@

var get$1 = end(value);
object[property] = end(value);
if (end.join) {
get$1 = joinToString(get$1);
}
object[property] = get$1;
} else if (Array.isArray(end)) {

@@ -1387,12 +1399,2 @@

},
color: {
fill: 1,
stroke: 1,
color: 1,
backgroundColor: 1,
borderColor : 1,
outlineColor: 1,
boxShadowColor: 1,
textShadowColor: 1
},
scroll: {

@@ -1411,3 +1413,3 @@ scrollTop: 1,

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

@@ -1418,15 +1420,2 @@ }

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

@@ -1438,3 +1427,3 @@ var layer = this.domNode,

for (var p in RenderObject) {
if (cache.transform[p] || cache.filter[p] || cache.color[p]) { continue; }
if (cache.transform[p] || cache.filter[p]) { continue; }
style[p] = RenderObject[p];

@@ -1441,0 +1430,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=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})});
!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){var e=parseFloat(t);return"number"!=typeof e||isNaN(e)?t:e}function n(t){var e=t.from,n=t.to,r=t.duration;void 0===r&&(r=1e3);var i=t.easing;void 0===i&&(i=rt);var o=t.events,a=t.instance,s=new H(e,a).to(n,r).easing(rt);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:{},i=["webkit","moz","ms","o"],o="AnimationFrame",a="Request"+o,s="Cancel"+o,u="CancelRequest"+o,f=r.setTimeout,h=r.clearTimeout;if(f&&void 0===r.requestAnimationFrame){var p,c,l=Date.now(),d=50/3,v=d;i.map(function(t){void 0===(p=r[t+a])&&(p=function(t){return f(function(){c=Date.now(),t(c-l),v=d+(Date.now()-c)},v)})}),void 0!==p&&(r.requestAnimationFrame=p)}if(h&&void 0===r.cancelAnimationFrame&&void 0===(r.cancelAnimationFrame=r.cancelRequestAnimationFrame)){var y;i.map(function(t){void 0===(y=r[t+s])&&void 0===(y=r[t+u])&&(y=function(t){return h(t)})}),void 0!==y&&(r.cancelAnimationFrame=y)}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 m,_={},g=!1,b=!1,T={},w="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},O=0;Object.defineProperty(_,"length",{enumerable:!1,writable:!0,value:0});var I=function(t,e,n,r,i,o){var a=this,s=T[t];if(s)for(var u=s.length;u--;)s[u].call(a,e,n,r,i,o)},M=function(t,e){void 0===T[t]&&(T[t]=[]),T[t].push(e)},F=function(t,e){void 0===T[t]&&(T[t]=[]),M(t,function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];e.apply(void 0,n),j(t)})},j=function(t,e){if(void 0!==t&&void 0!==T[t])if(void 0!==e)for(var n=T[name],r=0;r<n.length;)n[r]===e&&n.splice(r,1),r++;else T[name]=[]},A=function(t){var e=t.id;_[e]=t,_.length++,b&&!g&&(q(),g=!0,I("start")),I("add",t,_)},P=function(){var t=O;return O++,t},x=function(){return _},E=function(t){b=t},S=function(){_={},Object.defineProperty(_,"length",{enumerable:!1,writable:!0,value:0})},D=function(t){for(var e in _)if(t.id===+e)return _[+e];return null},N=function(t){return null!==D(t)},k=function(t){for(var e in _)t.id===+e&&(delete _[+e],_.length--)},C=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!==w.performance&&void 0!==w.performance.now)return w.performance.now.bind(w.performance);var t=w.performance&&w.performance.timing&&w.performance.timing.navigationStart?w.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}(),q=function(t,e){if(t=void 0!==t?t:C(),b&&(m=requestAnimationFrame(q)),I("update",t,_),0===_.length)return g=!1,cancelAnimationFrame(m),I("stop",t),!1;for(var n in _)_[n].update(t)||e?n++:(delete _[+n],_.length--);return!0};if(w.document){var B=w.document,L=0,R=0;B.addEventListener("visibilitychange",function(t){if(0===_.length)return!1;if(document.hidden)R=C();else{L=C()-R;for(var e in _)_[e]._startTime+=L}return!0})}var z={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-z.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*z.Bounce.In(2*t):.5*z.Bounce.Out(2*t-1)+.5}}},J={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=J.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=J.Utils.Bernstein,a=0;a<=r;a++)n+=i(1-e,r-a)*i(e,a)*t[a]*o(r,a);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=J.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(e-t)*n+t},Bernstein:function(t,e){var n=J.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),a=.5*(r-e),s=i*i,u=i*s;return(2*e-2*n+o+a)*u+(-3*e+3*n-2*o-a)*s+o*i+e}}},U=/rgb|hsl|hsv/g,X=/ahsv|ahsl|argb/g,Y=/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi,Z=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,Q=function(t,e){var n,r,i;return 3===e.length?(n=parseInt(e[0]+e[0],16),r=parseInt(e[1]+e[1],16),i=parseInt(e[2]+e[2],16)):6===e.length&&(n=parseInt(e.substr(0,2),16),r=parseInt(e.substr(2,2),16),i=parseInt(e.substr(4,6),16)),"rgb("+n+","+r+","+i},V=function(t,n,r){if(void 0===r&&(r=1e4),Array.isArray(t)){var i=null,o=null;n=n.map(function(e,n){return U.test(e)?(i=e,o=n,null):e===t[n]?null:"number"==typeof e?e-t[n]:"string"==typeof e?e:V(t[n],e)});var a=null!==o?o+6:null;i&&X.test(i)&&(o++,a++);var s=[].concat(t);return function(e){for(var i=0,u=n.length;i<u;i++){var f=n[i];"function"==typeof f?s[i]=f(e):"number"==typeof f&&(s[i]=((t[i]+f*e)*r|0)/r,null!==o&&i>o&&i<a&&(s[i]=0|s[i]))}return s}}if("object"==typeof t){for(var u in n)n[u]===t[u]?n[u]=null:"object"==typeof n[u]?n[u]=V(t[u],n[u]):"number"==typeof t[u]&&(n[u]-=t[u]);var f=Object.assign({},t);return function(e){for(var i in n){var o=n[i];"function"==typeof o?f[i]=o(e):"number"==typeof o&&(f[i]=((t[i]+o*e)*r|0)/r)}return f}}if("number"==typeof t){n-=t;var h=t===n;return function(e){return h?n:((t+n*e)*r|0)/r}}if("string"==typeof t){var p=t.replace(Z,Q).match(Y).map(e),c=n.replace(Z,Q).match(Y).map(e),l=V(p,c);return function(t){for(var e=l(t),n=0,r="";n<e.length;)r+=e[n],n++;return r}}var d=t===n;return function(e){return d?t:e>=.5?n:t}},W={add:function(t){return W[t]&&JSON.stringify(t)&&JSON.stringify(W[t])?W[t]:(W[t]=t,t)}},G=1e4,$=z.Linear.None,H=function t(e,n){return void 0===e&&(e={}),this.isJoinToString="string"==typeof e,this.object=e,this._valuesStart=t.createEmptyConst(e),this._valuesEnd=t.createEmptyConst(e),this._duration=1e3,this._easingFunction=$,this._interpolationFunction=J.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=P(),n&&n.to?new t(e).to(n.to,n):this};H.createEmptyConst=function(t){return"number"==typeof t?0:Array.isArray(t)?[]:"object"==typeof t?{}:""},H.checkValidness=function(t){return void 0!==t&&null!==t&&""!==t&&NaN!==t&&t!==1/0},H.prototype.isPlaying=function(){return this._isPlaying},H.prototype.isStarted=function(){return this._onStartCallbackFired},H.prototype.reverse=function(){var t=this,e=t._reversed;return this._reversed=!e,this},H.prototype.reversed=function(){return this._reversed},H.prototype.useActiveMode=function(){return this.object=W.add(this.object),this},H.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],r=0;r<n.length;)n[r]===e&&n.splice(r,1),r++;else void 0!==t&&void 0===e&&(this._events[t]=[]);return this},H.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},H.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 r=[],i=arguments.length;i--;)r[i]=arguments[i];e.call.apply(e,[n].concat(r)),n.off(t)})},H.prototype.emit=function(t,e,n,r,i,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,r,i,o);return this},H.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,k(this),this._pausedTime=C(),this.emit("pause",this.object)):this},H.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=C()-this._pausedTime,A(this),this._pausedTime=C(),this.emit("play",this.object))},H.prototype.restart=function(t){return this._repeat=this._r,this._startTime=C()+(t?0:this._delayTime),this._isPlaying||A(this),this.emit("restart",this._object)},H.prototype.seek=function(t,e){return this._startTime=C()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this._object),e?this:this.pause()},H.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},H.prototype.to=function(t,e){var n=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=V(this.object,t):this._valuesEnd=t;if("number"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var i in e)n[i]&&(o=n)[i].apply(o,Array.isArray(e)?e:[e]);return this;var o},H.prototype.render=function(){var t=this,e=this,n=(e._startTime,e._delayTime,e._valuesEnd),r=(e._valuesStart,e.object);if("object"==typeof n)for(var i in n)"object"==typeof n[i]&&n[i]?(t._valuesEnd[i]=V(r[i],n[i]),t.object[i]=t._valuesEnd[i](0)):"string"==typeof n[i]&&"string"==typeof r[i]&&(t._valuesEnd[i]=V(r[i],n[i]),t.object[i]=t._valuesEnd[i](0)),H.checkValidness(r[i])!==!1&&r[i]!==n[i]&&(t._valuesStart[i]=r[i])},H.prototype.start=function(t){return this._startTime=void 0!==t?t:C(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,A(this),this.emit("start",this.object),this._isPlaying=!0,this},H.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object;return e?(k(this),this._isPlaying=!1,this.emit("stop",n)):this},H.prototype.end=function(){var t=this,e=t._startTime,n=t._duration;return this.update(e+n)},H.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this._startTime+=this._delayTime,this},H.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this},H.prototype.repeatDelay=function(t){return this._repeatDelayTime="function"==typeof t?t(this._repeatDelayTime):t,this},H.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},H.prototype.yoyo=function(t){return this._yoyo="function"==typeof t?t(this._yoyo):t,this},H.prototype.easing=function(t){return this._easingFunction=t,this},H.prototype.interpolation=function(t){return this._interpolationFunction=t,this},H.prototype.get=function(t){return this.update(t),this.object},H.prototype.update=function(t){var e,n,r,i=this,o=this,a=o._onStartCallbackFired,s=o._easingFunction,u=o._interpolationFunction,f=o._repeat,h=o._repeatDelayTime,p=o._reverseDelayTime,c=(o._delayTime,o._yoyo),l=o._reversed,d=o._startTime,v=o._duration,y=o._valuesStart,m=o._valuesEnd,_=o.object;o.isJoinToString;if(t=void 0!==t?t:C(),t<d)return!0;if(a||(this._rendered||(this.render(),this.emit("start",_),this._rendered=!0),this._onStartCallbackFired=!0),n=(t-d)/v,n=n>1?1:n,n=l?1-n:n,r="function"==typeof s?s(n):$(n),"function"==typeof m)this.emit("update",m(n),r,n);else{for(e in m)if(void 0!==y[e]){var g=y[e],b=m[e];r=s[e]?s[e](n):r,"function"==typeof b?_[e]=b(r):Array.isArray(b)?_[e]=u(b,r):"string"==typeof b?(b="+"===b.charAt(0)||"-"===b.charAt(0)?g+parseFloat(b):parseFloat(b),"number"==typeof b&&(_[e]=((g+(b-g)*r)*G|0)/G)):"number"==typeof g&&(_[e]=((g+(b-g)*r)*G|0)/G)}this.emit("update",_,r,n)}if(1===n||l&&0===n){if(f){isFinite(f)&&this._repeat--;for(e in m)"string"==typeof m[e]&&"number"==typeof y[e]&&(i._valuesStart[e]=y[e]+parseFloat(m[e]));return this.emit(l?"reverse":"repeat",_),c&&(this._reversed=!l),!l&&h?this._startTime+=v+h:l&&p?this._startTime+=v+p:this._startTime+=v,!0}return this.emit("complete",_),this._repeat=this._r,!1}return!0};var K={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},scroll:{scrollTop:1,scrollLeft:1}},tt=function(){};tt.Attr=function(t){var e=this.domNode;return{update:function(t,n){for(var r in t)K.transform[r]||K.filter[r]||K.scroll[r]||e.setAttribute(r,t[r])}}},tt.Style=function(){var t=this.domNode,e=t.style;return{update:function(t){for(var n in t)K.transform[n]||K.filter[n]||(e[n]=t[n])}}},tt.Transform=function(){var t=this.domNode,e=t.style;return{update:function(t){var n="";for(var r in t)K.transform[r]&&("x"===r||"y"===r||"z"===r?n+=" translate3d( "+(t.x||"0px")+", "+(t.y||"0px")+", "+(t.z||"0px")+")":K.transform[r]&&(n+=" "+r+"( "+t[r]+")"));n&&(e.transform=n)}}},tt.SVGTransform=function(t,e){var n,r=this.domNode,i={},o="transform",a="rotate",s="x",u="y";return n={update:function(f){var h="";for(var p in f)K[o][p]&&(void 0!==i.x&&void 0!==i.y?h+=p===a?" rotate("+f[p]+" "+i.x+" "+i.y+")":p===s||p===u?" translate("+(f.x||0)+", "+(f.y||0)+")":" "+p+"("+f[p]+")":n.setOrigin(t,e));return h&&r.setAttribute(o,h),n},init:function(r,i){return n.setOrigin(t,e)},setOrigin:function(t,e){var o=r.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!==i.x&&void 0!==i.y&&(t+=t-diffX,e+=e-diffY),i.x=t,i.y=e,n}}},tt.Filter=function(){var t=this.domNode,e=t.style;return{update:function(t){var n="";for(var r in t)K.filter[r]&&K.filter[r]&&(n+=" "+r+"( "+t[r]+")");n&&(e.webkitFilter=e.filter=n)}}},tt.Scroll=function(){var t=this.domNode;return{update:function(e){for(var n in e)K.scroll[n]&&(t[n]=e[n])}}};var et=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};et.prototype.map=function(t){for(var e=this,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];var i=this,o=i.plugins;for(var a in o){var s=o[a];s&&s[t]&&s[t].apply(e,n)}return this},et.prototype.render=function(t,e,n){return this.map("update",t,e,n)},et.prototype.init=function(t){return this.map("init",t)},et.prototype.fetch=function(t){return this.map("fetch",fetch)},et.prototype.applyPlugin=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return void 0!==tt[t]?(this.plugins[t]=tt[t].apply(this,e),this.plugins[t]):this},et.prototype.appendTo=function(t){return t.appendChild(this.domNode),this};var nt=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=C(),this._tweens={},this._elapsed=0,this._id=P(),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 r=this,i=t+n;if("string"==typeof e){for(var o in r._labels)if(0===e.indexOf(o)){var a=e.split(o)[1];0!==a.length&&"+"!==a[0]&&"-"!==a[0]||(i=r._labels[o]+t,e=e.replace(o,""))}0!==e.indexOf("+")&&0!==e.indexOf("-")||(i+=parseFloat(e))}else"number"==typeof e&&(i+=e);return i},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 r=this,i=r._defaultParams,o=r._totalDuration;if(i)for(var a in i)e[a](i[a]);return e._startTime=this.parsePosition(0,n,o),e._startTime+=C(),this._totalDuration=Math.max(o,e._duration+e._startTime),this._tweens[e.id]=e,this},e.prototype.restart=function(){return this._startTime+=C(),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,r=e._totalDuration,i=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)/r));h=s?1-h:h,this._elapsed=h;var p=t-a,c=s?r-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&&i?this._startTime+=r+i:s&&o?this._startTime+=r+o:this._startTime+=r;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}(H),rt=function(t){return t};t.TweenInit=n,t.nextId=P,t.has=N,t.get=D,t.getAll=x,t.removeAll=S,t.remove=k,t.add=A,t.now=C,t.update=q,t.autoPlay=E,t.on=M,t.once=F,t.off=j,t.emit=I,t.Tween=H,t.Easing=z,t.Interpolation=J,t.Composite=et,t.Timeline=nt,t.Plugins=tt,t.PropertyTypes=K,Object.defineProperty(t,"__esModule",{value:!0})});

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

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

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

@@ -33,12 +33,2 @@ const cache = {

},
color: {
fill: 1,
stroke: 1,
color: 1,
backgroundColor: 1,
borderColor : 1,
outlineColor: 1,
boxShadowColor: 1,
textShadowColor: 1
},
scroll: {

@@ -58,3 +48,3 @@ scrollTop: 1,

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

@@ -65,15 +55,2 @@ }

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

@@ -85,3 +62,3 @@ let layer = this.domNode,

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

@@ -88,0 +65,0 @@ }

@@ -0,4 +1,38 @@

import toNumber from './toNumber';
let colorMatch = /rgb|hsl|hsv/g;
let isIncrementReqForColor = /ahsv|ahsl|argb/g;
// Credits:
// @jkroso for string parse library
// Optimized, Extended by @dalisoft
const Number_Match_RegEx =
/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi;
let hexColor = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i;
let hexReplace = (all, hex) => {
let r
let g
let b
if (hex.length === 3) {
r = parseInt(hex[0] + hex[0], 16);
g = parseInt(hex[1] + hex[1], 16);
b = parseInt(hex[2] + hex[2], 16);
} else if (hex.length === 6) {
r = parseInt(hex.substr(0, 2), 16)
g = parseInt(hex.substr(2, 2), 16)
b = parseInt(hex.substr(4, 6), 16)
}
return `rgb(${r},${g},${b}`;
}
const SubTween = (start, end, roundv = 10000) => {
if (Array.isArray(start)) {
end = end.map((v, i) => v === start[i] ? null : typeof v === "number" ? v - start[i] : typeof v === "string" ? v : SubTween(start[i], v));
let isColorPropsExist = null;
let startIndex = null
end = end.map((v, i) => colorMatch.test(v) ? (isColorPropsExist = v, startIndex = i, null) : v === start[i] ? null : typeof v === "number" ? v - start[i] : typeof v === "string" ? v : SubTween(start[i], v));
let endIndex = startIndex !== null ? startIndex + 6 : null;
if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {
startIndex++;
endIndex++;
}
let map = [...start];

@@ -12,3 +46,8 @@ return (t) => {

map[i] = (((start[i] + v * t) * roundv) | 0) / roundv;
if (startIndex !== null && i > startIndex && i < endIndex) {
map[i] = map[i] | 0;
}
}
}

@@ -45,2 +84,16 @@ return map;

}
} else if (typeof start === "string") {
let _startMap = start.replace(hexColor, hexReplace).match(Number_Match_RegEx).map(toNumber);
let _endMap = end.replace(hexColor, hexReplace).match(Number_Match_RegEx).map(toNumber);
let _tween = SubTween(_startMap, _endMap);
return (t) => {
let _t = _tween(t);
let i = 0;
let s = '';
while (i < _t.length) {
s += _t[i];
i++
}
return s
}
} else {

@@ -47,0 +100,0 @@ let isSame = start === end;

@@ -10,12 +10,5 @@ import {

import Interpolation from './Interpolation';
import joinToString from './joinToString';
import toNumber from './toNumber';
import SubTween from './SubTween';
import Store from './Store';
// Credits:
// @jkroso for string parse library
// Optimized, Extended by @dalisoft
const Number_Match_RegEx =
/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi;

@@ -28,5 +21,3 @@ const maxDecNum = 10000;

this.isJoinToString = typeof object === "string" && Number_Match_RegEx.test(object);
object = this.isJoinToString ? object.match(Number_Match_RegEx)
.map(toNumber) : object;
this.isJoinToString = typeof object === "string";
this.object = object;

@@ -218,3 +209,3 @@ this._valuesStart = Tween.createEmptyConst(object);

} else if (typeof properties === "string" && this.isJoinToString) {
this._valuesEnd = SubTween(this.object, properties.match(Number_Match_RegEx).map(toNumber));
this._valuesEnd = SubTween(this.object, properties);
} else {

@@ -256,14 +247,7 @@ this._valuesEnd = properties;

} else if (typeof _valuesEnd[property] === "string" && typeof object[property] === "string" &&
Number_Match_RegEx.test(object[property]) && Number_Match_RegEx.test(_valuesEnd[property])) {
} else if (typeof _valuesEnd[property] === "string" && typeof object[property] === "string") {
let __get__Start = object[property].match(Number_Match_RegEx);
__get__Start = __get__Start.map(toNumber);
let __get__End = _valuesEnd[property].match(Number_Match_RegEx);
__get__End = __get__End.map(toNumber);
this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
this.object[property] = this._valuesEnd[property](0);
this._valuesEnd[property] = SubTween(__get__Start, __get__End);
this._valuesEnd[property].join = true;
this.object[property] = joinToString(this._valuesEnd[property](0))
}

@@ -442,12 +426,4 @@

let get = _valuesEnd(elapsed);
this.emit('update', _valuesEnd(elapsed), value, elapsed);
if (isJoinToString) {
get = joinToString(get);
}
this.emit('update', get, value, elapsed);
} else {

@@ -468,12 +444,4 @@

let get = end(value);
object[property] = end(value);
if (end.join) {
get = joinToString(get);
}
object[property] = get;
} else if (Array.isArray(end)) {

@@ -480,0 +448,0 @@

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