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.5.2 to 2.5.3

30

dist/Tween.js

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

Linear: function Linear (p0, p1, t) {
return (p1 - p0) * t + p0
return typeof p1 === 'function' ? p1(t) : (p1 - p0) * t + p0
},

@@ -613,2 +613,3 @@

var hexColor = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i;
var trimRegExp = /\n|\r|\t/g;
var hexReplace = function (all, hex) {

@@ -628,4 +629,5 @@ var r;

return ("rgb(" + r + "," + g + "," + b)
return ("rgb(" + r + "," + g + "," + b + ")")
};
var trim = function (str) { return typeof str === 'string' ? str.replace(trimRegExp, '') : str; };

@@ -638,3 +640,3 @@ var SubTween = function (start, end, roundv) {

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]) : SubTween(start[i], v); });
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]) : numRegExp.test(v) ? SubTween(trim(start[i]), trim(v)) : v; });
var endIndex = startIndex !== null ? startIndex + 6 : null;

@@ -669,3 +671,3 @@ if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {

end[property] -= start[property];
} else if (typeof end[property] === 'object' || typeof [end] === 'string') {
} else if (typeof end[property] === 'object' || (typeof end[property] === 'string' && numRegExp.test(end[property]))) {
end[property] = SubTween(start[property], end[property]);

@@ -694,5 +696,5 @@ }

}
} else if (typeof start === 'string') {
var _startMap = start.replace(hexColor, hexReplace).match(numRegExp).map(toNumber);
var _endMap = end.replace(hexColor, hexReplace).match(numRegExp).map(toNumber);
} else if ((typeof start === 'string' && typeof end === 'string' && numRegExp.test(start) && numRegExp.test(end)) || (typeof end === 'string' && (hexColor.test(start) || hexColor.test(end)))) {
var _startMap = trim(start).replace(hexColor, hexReplace).match(numRegExp).map(toNumber);
var _endMap = trim(end).replace(hexColor, hexReplace).match(numRegExp).map(toNumber);
var _tween = SubTween(_startMap, _endMap);

@@ -712,2 +714,6 @@ return function (t) {

return end
} else if (!Array.isArray(start) && Array.isArray(end)) {
end.unshift(start);
end.push(end[end.length - 1]);
return end.map(function (v, i) { return SubTween(i === 0 ? start : end[i - 1], v); })
} else {

@@ -757,3 +763,3 @@ var isSame$1 = start === end;

this._easingFunction = defaultEasing;
this._interpolationFunction = Interpolation.None;
this._interpolationFunction = Interpolation.Linear;

@@ -909,6 +915,10 @@ this._startTime = 0;

this$1._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
this$1.object[property] = this$1._valuesEnd[property](0);
if (typeof this$1._valuesEnd[property] === 'function') {
this$1.object[property] = this$1._valuesEnd[property](0);
}
} else if (typeof _valuesEnd[property] === 'string' && typeof object[property] === 'string') {
this$1._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
this$1.object[property] = this$1._valuesEnd[property](0);
if (typeof this$1._valuesEnd[property] === 'function') {
this$1.object[property] = this$1._valuesEnd[property](0);
}
}

@@ -915,0 +925,0 @@

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.TWEEN=t.TWEEN||{})}(this,function(t){"use strict";function e(t){var e=parseFloat(t);return"number"!=typeof e||isNaN(e)?t:e}var n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(){this._events={},this._bind=this,this.on=n(this.on,this),this.once=n(this.once,this),this.off=n(this.off,this),this.emit=n(this.emit,this)};r.prototype.bind=function(t){return this._bind=t,this},r.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e),this},r.prototype.once=function(t,e){this._events[t]||(this._events[t]=[]);var n=this,r=n._events,i=n._bind,o=r[t].length;return this._events[t].push(function(){for(var n=[],s=arguments.length;s--;)n[s]=arguments[s];e.apply(i,n),r[t].splice(o,1)}),this},r.prototype.off=function(t,e){var n=this._events;return void 0!==t&&n[t]?(e?this._events[t]=this._events[t].filter(function(t){return t!==e}):this._events[t].length=0,this):this},r.prototype.emit=function(t,e,n,r,i){var o=this,s=o._events,a=o._bind;if(void 0===t||!s[t])return this;for(var u=s[t],f=0,h=u.length;f<h;f++)u[f].call(a,e,n,r,i)};var i,o={},s=!1,a=!1,u=new r,f=u.emit,h=u.on,p=u.once,c=u.off,l="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d=0,y=function(t){return"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(t):setTimeout(t,16.6)},v=function(t){return"undefined"!=typeof cancelAnimationFrame?cancelAnimationFrame(t):clearTimeout(t)};!function(t,e,n){Object.defineProperty(t,e,n)}(o,"length",{enumerable:!1,writable:!0,value:0});var _=function(t){var e=t.id;o[e]=t,o.length++,a&&!s&&(I(),s=!0,f("start")),f("add",t,o)},m=function(){var t=d;return d++,t},g=function(t){for(var e in o)if(t.id===+e)return o[+e];return null},b=function(t){for(var e in o)t.id===+e&&(delete o[+e],o.length--)},T=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!==l.performance&&void 0!==l.performance.now)return l.performance.now.bind(l.performance);var t=l.performance&&l.performance.timing&&l.performance.timing.navigationStart?l.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}(),I=function(t,e){if(t=void 0!==t?t:T(),a&&(i=y(I)),f("update",t,o),0===o.length)return s=!1,v(i),f("stop",t),!1;for(var n in o)o[n].update(t)||e?n++:(delete o[+n],o.length--);return!0};if(l.document){var M=0,O=0;l.document.addEventListener("visibilitychange",function(){if(0===o.length)return!1;if(document.hidden)O=T();else{M=T()-O;for(var t in o)o[t]._startTime+=M}return!0})}var w={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-w.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*w.Bounce.In(2*t):.5*w.Bounce.Out(2*t-1)+.5}}},P={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=P.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=P.Utils.Bernstein,s=0;s<=r;s++)n+=i(1-e,r-s)*i(e,s)*t[s]*o(r,s);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=P.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=P.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:function(){var t=[1];return function(e){var n=1;if(t[e])return t[e];for(var r=e;r>1;r--)n*=r;return t[e]=n,n}}(),CatmullRom:function(t,e,n,r,i){var o=.5*(n-t),s=.5*(r-e),a=i*i;return(2*e-2*n+o+s)*(i*a)+(-3*e+3*n-2*o-s)*a+o*i+e}}},j=/rgb|hsl|hsv/g,F=/ahsv|ahsl|argb/g,x=/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,A=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,E=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},N=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 j.test(e)?(i=e,o=n,null):e===t[n]?null:"number"==typeof e?e-t[n]:N(t[n],e)});var s=null!==o?o+6:null;i&&F.test(i)&&(o++,s++);var a=[].concat(t);return function(e){for(var i=0,u=void 0,f=n.length;i<f;i++)"function"==typeof(u=n[i])?a[i]=u(e):"number"==typeof u&&(a[i]=((t[i]+u*e)*r|0)/r,null!==o&&i>o&&i<s&&(a[i]=0|a[i]));return a}}if("object"==typeof t){for(var u in n)n[u]===t[u]?n[u]=null:"number"==typeof t[u]?n[u]-=t[u]:"object"!=typeof n[u]&&"string"!=typeof[n]||(n[u]=N(t[u],n[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){var h=t===(n-=t);return function(e){return h?n:((t+n*e)*r|0)/r}}if("string"==typeof t){var p=t.replace(A,E).match(x).map(e),c=n.replace(A,E).match(x).map(e),l=N(p,c);return function(t){for(var e=l(t),n=0,r="";n<e.length;)r+=e[n],n++;return r}}if("function"==typeof n)return n;var d=t===n;return function(e){return d?t:e>=.5?n:t}},S={add:function(t){return S[t]&&JSON.stringify(t)&&JSON.stringify(S[t])?S[t]:(S[t]=t,t)}},k=w.Linear.None,D=function(t){function e(n,r){return void 0===n&&(n={}),t.call(this),this.isJoinToString="string"==typeof n,this.object=n,this._valuesStart=e.createEmptyConst(n),this._valuesEnd=e.createEmptyConst(n),this._duration=1e3,this._easingFunction=k,this._interpolationFunction=P.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=m(),r&&r.to?new e(n).to(r.to,r):this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.createEmptyConst=function(t){return"number"==typeof t?0:Array.isArray(t)?[]:"object"==typeof t?{}:""},e.checkValidness=function(t){return void 0!==t&&null!==t&&""!==t&&("number"==typeof t&&!isNaN(t)||"number"!=typeof t)&&t!==1/0},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isStarted=function(){return this._onStartCallbackFired},e.prototype.reverse=function(){var t=this._reversed;return this._reversed=!t,this},e.prototype.reversed=function(){return this._reversed},e.prototype.useActiveMode=function(){return this.object=S.add(this.object),this},e.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,b(this),this._pausedTime=T(),this.emit("pause",this.object)):this},e.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=T()-this._pausedTime,_(this),this._pausedTime=T(),this.emit("play",this.object))},e.prototype.restart=function(t){return this._repeat=this._r,this._startTime=T()+(t?0:this._delayTime),this._isPlaying||_(this),this.emit("restart",this._object)},e.prototype.seek=function(t,e){return this._startTime=T()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this._object),e?this:this.pause()},e.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},e.prototype.to=function(t,e){var n=this;if(void 0===t&&(t={}),void 0===e&&(e=1e3),"object"==typeof t&&(this._valuesEnd=t),"number"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var r in e)n[r]&&(i=n)[r].apply(i,Array.isArray(e)?e:[e]);return this;var i},e.prototype.render=function(){var t=this;if(this._rendered)return this;var n=this,r=n._valuesEnd,i=n.object;for(var o in r)"object"==typeof r[o]&&r[o]?(t._valuesEnd[o]=N(i[o],r[o]),t.object[o]=t._valuesEnd[o](0)):"string"==typeof r[o]&&"string"==typeof i[o]&&(t._valuesEnd[o]=N(i[o],r[o]),t.object[o]=t._valuesEnd[o](0)),!1!==e.checkValidness(i[o])&&i[o]!==r[o]&&(t._valuesStart[o]=i[o]);return this},e.prototype.start=function(t){return this._startTime=void 0!==t?t:T(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,_(this),this.emit("start",this.object),this._isPlaying=!0,this},e.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object;return e?(b(this),this._isPlaying=!1,this.emit("stop",n)):this},e.prototype.end=function(){var t=this,e=t._startTime,n=t._duration;return this.update(e+n)},e.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this._startTime+=this._delayTime,this},e.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime="function"==typeof t?t(this._repeatDelayTime):t,this},e.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},e.prototype.yoyo=function(t){return this._yoyo="function"==typeof t?t(this._yoyo):t,this},e.prototype.easing=function(t){return this._easingFunction=t,this},e.prototype.interpolation=function(t){return this._interpolationFunction=t,this},e.prototype.get=function(t){return this.update(t),this.object},e.prototype.update=function(t){var e,n,r,i=this,o=this,s=o._onStartCallbackFired,a=o._easingFunction,u=o._interpolationFunction,f=o._repeat,h=o._repeatDelayTime,p=o._reverseDelayTime,c=o._yoyo,l=o._reversed,d=o._startTime,y=o._duration,v=o._valuesStart,_=o._valuesEnd,m=o.object;if((t=void 0!==t?t:T())<d)return!0;s||(this._rendered||(this.render(),this.emit("start",m),this._rendered=!0),this._onStartCallbackFired=!0),n=(n=(t-d)/y)>1?1:n,n=l?1-n:n,r="function"==typeof a?a(n):k(n);for(e in _)if(void 0!==v[e]){var g=v[e],b=_[e];r=a[e]?a[e](n):r,"function"==typeof b?m[e]=b(r):Array.isArray(b)?m[e]=u(b,r):"string"==typeof b?"number"==typeof(b="+"===b.charAt(0)||"-"===b.charAt(0)?g+parseFloat(b):parseFloat(b))&&(m[e]=g+(b-g)*r):"number"==typeof g&&(m[e]=g+(b-g)*r)}if(this.emit("update",m,r,n),this.object=m,1===n||l&&0===n){if(f){isFinite(f)&&this._repeat--;for(e in _)"string"==typeof _[e]&&"number"==typeof v[e]&&(i._valuesStart[e]=v[e]+parseFloat(_[e]));return this.emit(l?"reverse":"repeat",m),c&&(this._reversed=!l),this._startTime+=!l&&h?y+h:l&&p?y+p:y,!0}return this.emit("complete",m),this._repeat=this._r,!1}return!0},e}(r),C={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}},B=function(){};B.Attr=function(){var t=this.domNode;return{update:function(e){for(var n in e)C.transform[n]||C.filter[n]||C.scroll[n]||t.setAttribute(n,e[n])}}},B.Style=function(){var t=this.domNode.style;return{update:function(e){for(var n in e)C.transform[n]||C.filter[n]||(t[n]=e[n])}}},B.Transform=function(){var t=this.domNode.style;return{update:function(e){var n="";for(var r in e)C.transform[r]&&("x"===r||"y"===r||"z"===r?n+=" translate3d( "+(e.x||"0px")+", "+(e.y||"0px")+", "+(e.z||"0px")+")":C.transform[r]&&(n+=" "+r+"( "+e[r]+")"));n&&(t.transform=n)}}},B.SVGTransform=function(t,e){var n=this.domNode,r={},i=null;return i={update:function(o){var s="";for(var a in o)C.transform[a]&&(void 0!==r.x&&void 0!==r.y?s+="rotate"===a?" rotate("+o[a]+" "+r.x+" "+r.y+")":"x"===a||"y"===a?" translate("+(o.x||0)+", "+(o.y||0)+")":" "+a+"("+o[a]+")":i.setOrigin(t,e));return s&&n.setAttribute("transform",s),i},init:function(){return i.setOrigin(t,e)},setOrigin:function(t,e){var o=n.getBoundingClientRect(),s=o.width,a=o.height,u=o.left,f=o.top;return t="number"==typeof t?u+t:"string"==typeof t&&t.indexOf("%")>-1?u+s*(parseFloat(t)/100):u+s/2,e="number"==typeof e?u+e:"string"==typeof e&&e.indexOf("%")>-1?f+a*(parseFloat(e)/100):f+a/2,void 0!==r.x&&void 0!==r.y&&(t+=t-(r.x-t),e+=e-(r.y-e)),r.x=t,r.y=e,i}}},B.Filter=function(){var t=this.domNode.style;return{update:function(e){var n="";for(var r in e)C.filter[r]&&C.filter[r]&&(n+=" "+r+"( "+e[r]+")");n&&(t.webkitFilter=t.filter=n)}}},B.Scroll=function(){var t=this.domNode;return{update:function(e){for(var n in e)C.scroll[n]&&(t[n]=e[n])}}};var L=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};L.prototype.map=function(t){for(var e=this,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];var i=this.plugins;for(var o in i){var s=i[o];s&&s[t]&&s[t].apply(e,n)}return this},L.prototype.render=function(t,e,n){return this.map("update",t,e,n)},L.prototype.init=function(t){return this.map("init",t)},L.prototype.fetch=function(t){return this.map("fetch",t)},L.prototype.applyPlugin=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return void 0!==B[t]?(this.plugins[t]=B[t].apply(this,e),this.plugins[t]):this},L.prototype.appendTo=function(t){return t.appendChild(this.domNode),this};var q=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=T(),this._tweens={},this._elapsed=0,this._id=m(),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 s=e.split(o)[1];0!==s.length&&"+"!==s[0]&&"-"!==s[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,e));var r=this,i=r._defaultParams,o=r._totalDuration;if(i)for(var s in i)e[s](i[s]);return e._startTime=this.parsePosition(0,n,o),e._startTime+=T(),this._totalDuration=Math.max(o,e._duration+e._startTime),this._tweens[e.id]=e,this},e.prototype.restart=function(){return this._startTime+=T(),_(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,s=e._startTime,a=e._reversed,u=e._yoyo,f=e._repeat;if(t<s)return!0;var h=Math.min(1,Math.max(0,(t-s)/r));h=a?1-h:h,this._elapsed=h;var p=t-s,c=a?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||a&&0===h){if(f){isFinite(f)&&this._repeat--,this.emit(a?"reverse":"repeat"),u&&(this._reversed=!a),this._startTime+=!a&&i?r+i:a&&o?r+o:r;for(var y in n){var v=n[y];v.skip&&(v.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.prototype.seek=function(t){return this.update(t<1.1?t*this._totalDuration:t)},e}(D),z=function(t){return t};t.TweenInit=function(t){var e=t.from,n=t.to,r=t.duration;void 0===r&&(r=1e3);var i=t.easing;void 0===i&&(i=z);var o=t.events,s=t.instance,a=new D(e,s).to(n,r).easing(i);o&&(a._events=o),t.start=a.start.bind(a)},t.nextId=m,t.has=function(t){return null!==g(t)},t.get=g,t.getAll=function(){return o},t.removeAll=function(){for(var t in o)o[+t]=null,delete o[+t];o.length=0},t.remove=b,t.add=_,t.now=T,t.update=I,t.autoPlay=function(t){a=t},t.on=h,t.once=p,t.off=c,t.emit=f,t.Tween=D,t.Easing=w,t.Interpolation=P,t.Composite=L,t.Timeline=q,t.Plugins=B,t.PropertyTypes=C,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}var n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(){this._events={},this._bind=this,this.on=n(this.on,this),this.once=n(this.once,this),this.off=n(this.off,this),this.emit=n(this.emit,this)};r.prototype.bind=function(t){return this._bind=t,this},r.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e),this},r.prototype.once=function(t,e){this._events[t]||(this._events[t]=[]);var n=this,r=n._events,i=n._bind,o=r[t].length;return this._events[t].push(function(){for(var n=[],s=arguments.length;s--;)n[s]=arguments[s];e.apply(i,n),r[t].splice(o,1)}),this},r.prototype.off=function(t,e){var n=this._events;return void 0!==t&&n[t]?(e?this._events[t]=this._events[t].filter(function(t){return t!==e}):this._events[t].length=0,this):this},r.prototype.emit=function(t,e,n,r,i){var o=this,s=o._events,a=o._bind;if(void 0===t||!s[t])return this;for(var u=s[t],f=0,p=u.length;f<p;f++)u[f].call(a,e,n,r,i)};var i,o={},s=!1,a=!1,u=new r,f=u.emit,p=u.on,h=u.once,c=u.off,l="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d=0,y=function(t){return"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(t):setTimeout(t,16.6)},v=function(t){return"undefined"!=typeof cancelAnimationFrame?cancelAnimationFrame(t):clearTimeout(t)};!function(t,e,n){Object.defineProperty(t,e,n)}(o,"length",{enumerable:!1,writable:!0,value:0});var _=function(t){var e=t.id;o[e]=t,o.length++,a&&!s&&(I(),s=!0,f("start")),f("add",t,o)},m=function(){var t=d;return d++,t},g=function(t){for(var e in o)if(t.id===+e)return o[+e];return null},b=function(t){for(var e in o)t.id===+e&&(delete o[+e],o.length--)},T=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!==l.performance&&void 0!==l.performance.now)return l.performance.now.bind(l.performance);var t=l.performance&&l.performance.timing&&l.performance.timing.navigationStart?l.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}(),I=function(t,e){if(t=void 0!==t?t:T(),a&&(i=y(I)),f("update",t,o),0===o.length)return s=!1,v(i),f("stop",t),!1;for(var n in o)o[n].update(t)||e?n++:(delete o[+n],o.length--);return!0};if(l.document){var M=0,O=0;l.document.addEventListener("visibilitychange",function(){if(0===o.length)return!1;if(document.hidden)O=T();else{M=T()-O;for(var t in o)o[t]._startTime+=M}return!0})}var w={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-w.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*w.Bounce.In(2*t):.5*w.Bounce.Out(2*t-1)+.5}}},P={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=P.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=P.Utils.Bernstein,s=0;s<=r;s++)n+=i(1-e,r-s)*i(e,s)*t[s]*o(r,s);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=P.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(r=n*(1+e))),o(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],r-i)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):o(t[i?i-1:0],t[i],t[n<i+1?n:i+1],t[n<i+2?n:i+2],r-i)},Utils:{Linear:function(t,e,n){return"function"==typeof e?e(n):(e-t)*n+t},Bernstein:function(t,e){var n=P.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:function(){var t=[1];return function(e){var n=1;if(t[e])return t[e];for(var r=e;r>1;r--)n*=r;return t[e]=n,n}}(),CatmullRom:function(t,e,n,r,i){var o=.5*(n-t),s=.5*(r-e),a=i*i;return(2*e-2*n+o+s)*(i*a)+(-3*e+3*n-2*o-s)*a+o*i+e}}},j=/rgb|hsl|hsv/g,F=/ahsv|ahsl|argb/g,x=/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,A=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,E=/\n|\r|\t/g,S=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+")"},k=function(t){return"string"==typeof t?t.replace(E,""):t},D=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 j.test(e)?(i=e,o=n,null):e===t[n]?null:"number"==typeof e?e-t[n]:x.test(e)?D(k(t[n]),k(e)):e});var s=null!==o?o+6:null;i&&F.test(i)&&(o++,s++);var a=[].concat(t);return function(e){for(var i=0,u=void 0,f=n.length;i<f;i++)"function"==typeof(u=n[i])?a[i]=u(e):"number"==typeof u&&(a[i]=((t[i]+u*e)*r|0)/r,null!==o&&i>o&&i<s&&(a[i]=0|a[i]));return a}}if("object"==typeof t){for(var u in n)n[u]===t[u]?n[u]=null:"number"==typeof t[u]?n[u]-=t[u]:("object"==typeof n[u]||"string"==typeof n[u]&&x.test(n[u]))&&(n[u]=D(t[u],n[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){var p=t===(n-=t);return function(e){return p?n:((t+n*e)*r|0)/r}}if("string"==typeof t&&"string"==typeof n&&x.test(t)&&x.test(n)||"string"==typeof n&&(A.test(t)||A.test(n))){var h=k(t).replace(A,S).match(x).map(e),c=k(n).replace(A,S).match(x).map(e),l=D(h,c);return function(t){for(var e=l(t),n=0,r="";n<e.length;)r+=e[n],n++;return r}}if("function"==typeof n)return n;if(!Array.isArray(t)&&Array.isArray(n))return n.unshift(t),n.push(n[n.length-1]),n.map(function(e,r){return D(0===r?t:n[r-1],e)});var d=t===n;return function(e){return d?t:e>=.5?n:t}},N={add:function(t){return N[t]&&JSON.stringify(t)&&JSON.stringify(N[t])?N[t]:(N[t]=t,t)}},C=w.Linear.None,B=function(t){function e(n,r){return void 0===n&&(n={}),t.call(this),this.isJoinToString="string"==typeof n,this.object=n,this._valuesStart=e.createEmptyConst(n),this._valuesEnd=e.createEmptyConst(n),this._duration=1e3,this._easingFunction=C,this._interpolationFunction=P.Linear,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=m(),r&&r.to?new e(n).to(r.to,r):this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.createEmptyConst=function(t){return"number"==typeof t?0:Array.isArray(t)?[]:"object"==typeof t?{}:""},e.checkValidness=function(t){return void 0!==t&&null!==t&&""!==t&&("number"==typeof t&&!isNaN(t)||"number"!=typeof t)&&t!==1/0},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isStarted=function(){return this._onStartCallbackFired},e.prototype.reverse=function(){var t=this._reversed;return this._reversed=!t,this},e.prototype.reversed=function(){return this._reversed},e.prototype.useActiveMode=function(){return this.object=N.add(this.object),this},e.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,b(this),this._pausedTime=T(),this.emit("pause",this.object)):this},e.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=T()-this._pausedTime,_(this),this._pausedTime=T(),this.emit("play",this.object))},e.prototype.restart=function(t){return this._repeat=this._r,this._startTime=T()+(t?0:this._delayTime),this._isPlaying||_(this),this.emit("restart",this._object)},e.prototype.seek=function(t,e){return this._startTime=T()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this._object),e?this:this.pause()},e.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},e.prototype.to=function(t,e){var n=this;if(void 0===t&&(t={}),void 0===e&&(e=1e3),"object"==typeof t&&(this._valuesEnd=t),"number"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var r in e)n[r]&&(i=n)[r].apply(i,Array.isArray(e)?e:[e]);return this;var i},e.prototype.render=function(){var t=this;if(this._rendered)return this;var n=this,r=n._valuesEnd,i=n.object;for(var o in r)"object"==typeof r[o]&&r[o]?(t._valuesEnd[o]=D(i[o],r[o]),"function"==typeof t._valuesEnd[o]&&(t.object[o]=t._valuesEnd[o](0))):"string"==typeof r[o]&&"string"==typeof i[o]&&(t._valuesEnd[o]=D(i[o],r[o]),"function"==typeof t._valuesEnd[o]&&(t.object[o]=t._valuesEnd[o](0))),!1!==e.checkValidness(i[o])&&i[o]!==r[o]&&(t._valuesStart[o]=i[o]);return this},e.prototype.start=function(t){return this._startTime=void 0!==t?t:T(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,_(this),this.emit("start",this.object),this._isPlaying=!0,this},e.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object;return e?(b(this),this._isPlaying=!1,this.emit("stop",n)):this},e.prototype.end=function(){var t=this,e=t._startTime,n=t._duration;return this.update(e+n)},e.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this._startTime+=this._delayTime,this},e.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime="function"==typeof t?t(this._repeatDelayTime):t,this},e.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},e.prototype.yoyo=function(t){return this._yoyo="function"==typeof t?t(this._yoyo):t,this},e.prototype.easing=function(t){return this._easingFunction=t,this},e.prototype.interpolation=function(t){return this._interpolationFunction=t,this},e.prototype.get=function(t){return this.update(t),this.object},e.prototype.update=function(t){var e,n,r,i=this,o=this,s=o._onStartCallbackFired,a=o._easingFunction,u=o._interpolationFunction,f=o._repeat,p=o._repeatDelayTime,h=o._reverseDelayTime,c=o._yoyo,l=o._reversed,d=o._startTime,y=o._duration,v=o._valuesStart,_=o._valuesEnd,m=o.object;if((t=void 0!==t?t:T())<d)return!0;s||(this._rendered||(this.render(),this.emit("start",m),this._rendered=!0),this._onStartCallbackFired=!0),n=(n=(t-d)/y)>1?1:n,n=l?1-n:n,r="function"==typeof a?a(n):C(n);for(e in _)if(void 0!==v[e]){var g=v[e],b=_[e];r=a[e]?a[e](n):r,"function"==typeof b?m[e]=b(r):Array.isArray(b)?m[e]=u(b,r):"string"==typeof b?"number"==typeof(b="+"===b.charAt(0)||"-"===b.charAt(0)?g+parseFloat(b):parseFloat(b))&&(m[e]=g+(b-g)*r):"number"==typeof g&&(m[e]=g+(b-g)*r)}if(this.emit("update",m,r,n),this.object=m,1===n||l&&0===n){if(f){isFinite(f)&&this._repeat--;for(e in _)"string"==typeof _[e]&&"number"==typeof v[e]&&(i._valuesStart[e]=v[e]+parseFloat(_[e]));return this.emit(l?"reverse":"repeat",m),c&&(this._reversed=!l),this._startTime+=!l&&p?y+p:l&&h?y+h:y,!0}return this.emit("complete",m),this._repeat=this._r,!1}return!0},e}(r),L={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}},q=function(){};q.Attr=function(){var t=this.domNode;return{update:function(e){for(var n in e)L.transform[n]||L.filter[n]||L.scroll[n]||t.setAttribute(n,e[n])}}},q.Style=function(){var t=this.domNode.style;return{update:function(e){for(var n in e)L.transform[n]||L.filter[n]||(t[n]=e[n])}}},q.Transform=function(){var t=this.domNode.style;return{update:function(e){var n="";for(var r in e)L.transform[r]&&("x"===r||"y"===r||"z"===r?n+=" translate3d( "+(e.x||"0px")+", "+(e.y||"0px")+", "+(e.z||"0px")+")":L.transform[r]&&(n+=" "+r+"( "+e[r]+")"));n&&(t.transform=n)}}},q.SVGTransform=function(t,e){var n=this.domNode,r={},i=null;return i={update:function(o){var s="";for(var a in o)L.transform[a]&&(void 0!==r.x&&void 0!==r.y?s+="rotate"===a?" rotate("+o[a]+" "+r.x+" "+r.y+")":"x"===a||"y"===a?" translate("+(o.x||0)+", "+(o.y||0)+")":" "+a+"("+o[a]+")":i.setOrigin(t,e));return s&&n.setAttribute("transform",s),i},init:function(){return i.setOrigin(t,e)},setOrigin:function(t,e){var o=n.getBoundingClientRect(),s=o.width,a=o.height,u=o.left,f=o.top;return t="number"==typeof t?u+t:"string"==typeof t&&t.indexOf("%")>-1?u+s*(parseFloat(t)/100):u+s/2,e="number"==typeof e?u+e:"string"==typeof e&&e.indexOf("%")>-1?f+a*(parseFloat(e)/100):f+a/2,void 0!==r.x&&void 0!==r.y&&(t+=t-(r.x-t),e+=e-(r.y-e)),r.x=t,r.y=e,i}}},q.Filter=function(){var t=this.domNode.style;return{update:function(e){var n="";for(var r in e)L.filter[r]&&L.filter[r]&&(n+=" "+r+"( "+e[r]+")");n&&(t.webkitFilter=t.filter=n)}}},q.Scroll=function(){var t=this.domNode;return{update:function(e){for(var n in e)L.scroll[n]&&(t[n]=e[n])}}};var z=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};z.prototype.map=function(t){for(var e=this,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];var i=this.plugins;for(var o in i){var s=i[o];s&&s[t]&&s[t].apply(e,n)}return this},z.prototype.render=function(t,e,n){return this.map("update",t,e,n)},z.prototype.init=function(t){return this.map("init",t)},z.prototype.fetch=function(t){return this.map("fetch",t)},z.prototype.applyPlugin=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return void 0!==q[t]?(this.plugins[t]=q[t].apply(this,e),this.plugins[t]):this},z.prototype.appendTo=function(t){return t.appendChild(this.domNode),this};var R=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=T(),this._tweens={},this._elapsed=0,this._id=m(),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 s=e.split(o)[1];0!==s.length&&"+"!==s[0]&&"-"!==s[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,e));var r=this,i=r._defaultParams,o=r._totalDuration;if(i)for(var s in i)e[s](i[s]);return e._startTime=this.parsePosition(0,n,o),e._startTime+=T(),this._totalDuration=Math.max(o,e._duration+e._startTime),this._tweens[e.id]=e,this},e.prototype.restart=function(){return this._startTime+=T(),_(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,s=e._startTime,a=e._reversed,u=e._yoyo,f=e._repeat;if(t<s)return!0;var p=Math.min(1,Math.max(0,(t-s)/r));p=a?1-p:p,this._elapsed=p;var h=t-s,c=a?r-h:h;for(var l in n){var d=n[l];d.skip||d.update(c)||(d.skip=!0)}if(this.emit("update",p,h),1===p||a&&0===p){if(f){isFinite(f)&&this._repeat--,this.emit(a?"reverse":"repeat"),u&&(this._reversed=!a),this._startTime+=!a&&i?r+i:a&&o?r+o:r;for(var y in n){var v=n[y];v.skip&&(v.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.prototype.seek=function(t){return this.update(t<1.1?t*this._totalDuration:t)},e}(B),U=function(t){return t};t.TweenInit=function(t){var e=t.from,n=t.to,r=t.duration;void 0===r&&(r=1e3);var i=t.easing;void 0===i&&(i=U);var o=t.events,s=t.instance,a=new B(e,s).to(n,r).easing(i);o&&(a._events=o),t.start=a.start.bind(a)},t.nextId=m,t.has=function(t){return null!==g(t)},t.get=g,t.getAll=function(){return o},t.removeAll=function(){for(var t in o)o[+t]=null,delete o[+t];o.length=0},t.remove=b,t.add=_,t.now=T,t.update=I,t.autoPlay=function(t){a=t},t.on=p,t.once=h,t.off=c,t.emit=f,t.Tween=B,t.Easing=w,t.Interpolation=P,t.Composite=z,t.Timeline=R,t.Plugins=q,t.PropertyTypes=L,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=dist/Tween.min.js.map
//# sourceMappingURL=Tween.min.js.map
{
"name": "es6-tween",
"version": "2.5.2",
"version": "2.5.3",
"description": "ES6 implementation of amazing tween.js",

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

@@ -33,3 +33,4 @@ # es6-tween

* Play at [Codepen](https://codepen.io/dalisoft/pen/mMJmxX)
* Demo #1 [Morphing SVG Shape + Cross-browser SVG Transform](https://codepen.io/dalisoft/pen/mMJmxX)
* Demo #2 [Morphing SVG Shape](https://codepen.io/dalisoft/pen/BdLydv)

@@ -36,0 +37,0 @@ ## Installation

@@ -61,3 +61,3 @@ const Interpolation = {

Linear (p0, p1, t) {
return (p1 - p0) * t + p0
return typeof p1 === 'function' ? p1(t) : (p1 - p0) * t + p0
},

@@ -64,0 +64,0 @@

@@ -12,2 +12,3 @@ import toNumber from './toNumber'

let hexColor = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i
let trimRegExp = /\n|\r|\t/g
let hexReplace = (all, hex) => {

@@ -27,4 +28,5 @@ let r

return `rgb(${r},${g},${b}`
return `rgb(${r},${g},${b})`
}
let trim = str => typeof str === 'string' ? str.replace(trimRegExp, '') : str

@@ -35,3 +37,3 @@ const SubTween = (start, end, roundv = 10000) => {

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]) : SubTween(start[i], v))
end = end.map((v, i) => colorMatch.test(v) ? ((isColorPropsExist = v), (startIndex = i), null) : v === start[i] ? null : typeof v === 'number' ? (v - start[i]) : numRegExp.test(v) ? SubTween(trim(start[i]), trim(v)) : v)
let endIndex = startIndex !== null ? startIndex + 6 : null

@@ -66,3 +68,3 @@ if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {

end[property] -= start[property]
} else if (typeof end[property] === 'object' || typeof [end] === 'string') {
} else if (typeof end[property] === 'object' || (typeof end[property] === 'string' && numRegExp.test(end[property]))) {
end[property] = SubTween(start[property], end[property])

@@ -91,5 +93,5 @@ }

}
} else if (typeof start === 'string') {
let _startMap = start.replace(hexColor, hexReplace).match(numRegExp).map(toNumber)
let _endMap = end.replace(hexColor, hexReplace).match(numRegExp).map(toNumber)
} else if ((typeof start === 'string' && typeof end === 'string' && numRegExp.test(start) && numRegExp.test(end)) || (typeof end === 'string' && (hexColor.test(start) || hexColor.test(end)))) {
let _startMap = trim(start).replace(hexColor, hexReplace).match(numRegExp).map(toNumber)
let _endMap = trim(end).replace(hexColor, hexReplace).match(numRegExp).map(toNumber)
let _tween = SubTween(_startMap, _endMap)

@@ -109,2 +111,6 @@ return (t) => {

return end
} else if (!Array.isArray(start) && Array.isArray(end)) {
end.unshift(start)
end.push(end[end.length - 1])
return end.map((v, i) => SubTween(i === 0 ? start : end[i - 1], v))
} else {

@@ -111,0 +117,0 @@ let isSame = start === end

@@ -39,3 +39,3 @@ import {

this._easingFunction = defaultEasing
this._interpolationFunction = Interpolation.None
this._interpolationFunction = Interpolation.Linear

@@ -182,6 +182,10 @@ this._startTime = 0

this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property])
this.object[property] = this._valuesEnd[property](0)
if (typeof this._valuesEnd[property] === 'function') {
this.object[property] = this._valuesEnd[property](0)
}
} else if (typeof _valuesEnd[property] === 'string' && typeof object[property] === 'string') {
this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property])
this.object[property] = this._valuesEnd[property](0)
if (typeof this._valuesEnd[property] === 'function') {
this.object[property] = this._valuesEnd[property](0)
}
}

@@ -188,0 +192,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc