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 3.0.1 to 3.0.2

14

dist/Tween.js

@@ -546,9 +546,9 @@ (function (global, factory) {

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

@@ -732,6 +732,6 @@ if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {

if (object.node) {
this.node = object.node;
delete object.node;
}
if (object.node) {
this.node = object.node;
delete object.node;
}
this.object = object;

@@ -738,0 +738,0 @@ this._valuesStart = Tween.createEmptyConst(object);

@@ -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,r={},i=!1,o=!1,s="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a=0,u=function(t){return"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(t):setTimeout(t,16.6)},p=function(t){return"undefined"!=typeof cancelAnimationFrame?cancelAnimationFrame(t):clearTimeout(t)};!function(t,e,n){Object.defineProperty(t,e,n)}(r,"length",{enumerable:!1,writable:!0,value:0});var f=function(t){var e=t.id;r[e]=t,r.length++,o&&!i&&(d(),i=!0)},h=function(){var t=a;return a++,t},c=function(t){for(var e in r)if(t.id===+e)return r[+e];return null},l=function(t){for(var e in r)t.id===+e&&(delete r[+e],r.length--)},y=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!==s.performance&&void 0!==s.performance.now)return s.performance.now.bind(s.performance);var t=s.performance&&s.performance.timing&&s.performance.timing.navigationStart?s.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}(),d=function(t,e){if(t=void 0!==t?t:y(),o&&(n=u(d)),0===r.length)return i=!1,p(n),!1;for(var s in r)r[s].update(t)||e?s++:(delete r[+s],r.length--);return!0},_={};if(s.document){var v=0,m=0;s.document.addEventListener("visibilitychange",function(){if(0===r.length)return!1;if(document.hidden)m=y();else{v=y()-m;for(var t in r)r[t]._startTime+=v}return!0})}var g={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-g.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*g.Bounce.In(2*t):.5*g.Bounce.Out(2*t-1)+.5}}},b={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=b.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=b.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=b.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=b.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}}},T=/rgb|hsl|hsv/g,I=/ahsv|ahsl|argb/g,M=/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,O=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,w=/\n|\r|\t/g,j=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+")"},P=function(t){return"string"==typeof t?t.replace(w,""):t},E=function(t,n,r){if(void 0===r&&(r=1e4),"function"==typeof n||n&&n.nodeType)return n;if(t&&t.nodeType)return t;if(Array.isArray(t)){var i=null,o=null;n=n.map(function(e,n){return"string"==typeof e&&T.test(e)?(i=e,o=n,null):e===t[n]?null:"number"==typeof e?e-t[n]:"string"==typeof e&&M.test(e)?E(P(t[n]),P(e)):E(t[n],e)});var s=null!==o?o+6:null;i&&I.test(i)&&(o++,s++);var a=[].concat(t);return function(e){for(var i=0,u=void 0,p=n.length;i<p;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]&&M.test(n[u]))&&(n[u]=E(t[u],n[u]));var p=Object.assign({},t);return function(e){for(var i in n){var o=n[i];"function"==typeof o?p[i]=o(e):"number"==typeof o&&(p[i]=((t[i]+o*e)*r|0)/r)}return p}}if("number"==typeof t){var f=t===(n-=t);return function(e){return f?n:((t+n*e)*r|0)/r}}if("string"==typeof t&&"string"==typeof n&&M.test(t)&&M.test(n)||"string"==typeof n&&t&&(O.test(t)||O.test(n))){var h=P(t).replace(O,j).match(M).map(e),c=P(n).replace(O,j).match(M).map(e),l=E(h,c);return function(t){for(var e=l(t),n=0,r="";n<e.length;)r+=e[n],n++;return r}}return!Array.isArray(t)&&Array.isArray(n)?(n.unshift(t),n.push(n[n.length-1]),n.map(function(e,r){return E(0===r?t:n[r-1],e)})):n},F={add:function(t){return F[t]&&JSON.stringify(t)&&JSON.stringify(F[t])?F[t]:(F[t]=t,t)}},A=function(){this._events={}};A.prototype.bind=function(t){return this._bind=t,this},A.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e),this},A.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},A.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},A.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],p=0,f=u.length;p<f;p++)u[p].call(a,e,n,r,i)};var D=g.Linear.None,k=function(t){function e(n,r){return void 0===n&&(n={}),t.call(this),n.node&&(this.node=n.node,delete n.node),this.object=n,this._valuesStart=e.createEmptyConst(n),this._valuesEnd=e.createEmptyConst(n),this._duration=1e3,this._easingFunction=D,this._interpolationFunction=b.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=h(),this._plugins={},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=F.add(this.object),this},e.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,l(this),this._pausedTime=y(),this.emit("pause",this.object)):this},e.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=y()-this._pausedTime,f(this),this._pausedTime=y(),this.emit("play",this.object))},e.prototype.restart=function(t){return this._repeat=this._r,this._startTime=y()+(t?0:this._delayTime),this._isPlaying||f(this),this.emit("restart",this._object)},e.prototype.seek=function(t,e){return this._startTime=y()+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){var s=_[o];s&&(s=t._plugins[o]=new _[o](t,i[o],r[o])).preprocess&&s.preprocess(i[o],r[o]),"object"==typeof r[o]&&r[o]?(t._valuesEnd[o]=E(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]=E(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],s&&s.postprocess&&s.postprocess(t.object[o],t._valuesEnd[o])))}return this},e.prototype.start=function(t){return this._startTime=void 0!==t?t:y(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,f(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?(l(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,p=o._repeat,f=o._repeatDelayTime,h=o._reverseDelayTime,c=o._yoyo,l=o._reversed,d=o._startTime,_=o._duration,v=o._valuesStart,m=o._valuesEnd,g=o._plugins,b=o.object;if((t=void 0!==t?t:y())<d)return!0;s||(this._rendered||(this.render(),this.emit("start",b),this._rendered=!0),this._onStartCallbackFired=!0),n=(n=(t-d)/_)>1?1:n,n=l?1-n:n,r="function"==typeof a?a(n):D(n);for(e in m)if(void 0!==v[e]){var T=v[e],I=m[e],M=g[e];r=a[e]?a[e](n):r,M?M.update(r,n,l):"function"==typeof I?b[e]=I(r):Array.isArray(I)?b[e]=u(I,r):"string"==typeof I?"number"==typeof(I="+"===I.charAt(0)||"-"===I.charAt(0)?T+parseFloat(I):parseFloat(I))&&(b[e]=T+(I-T)*r):"number"==typeof T&&(b[e]=T+(I-T)*r)}if(this.emit("update",b,r,n),this.object=b,1===n||l&&0===n){if(p){isFinite(p)&&this._repeat--;for(e in m)"string"==typeof m[e]&&"number"==typeof v[e]&&(i._valuesStart[e]=v[e]+parseFloat(m[e]));return this.emit(l?"reverse":"repeat",b),c&&(this._reversed=!l),this._startTime+=!l&&f?_+f:l&&h?_+h:_,!0}return this.emit("complete",b),this._repeat=this._r,!1}return!0},e}(A),S=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=y(),this._tweens={},this._elapsed=0,this._id=h(),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+=y(),this._totalDuration=Math.max(o,e._duration+e._startTime),this._tweens[e.id]=e,this},e.prototype.restart=function(){return this._startTime+=y(),f(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,p=e._repeat;if(t<s)return!0;var f=Math.min(1,Math.max(0,(t-s)/r));f=a?1-f:f,this._elapsed=f;var h=t-s,c=a?r-h:h;for(var l in n){var y=n[l];y.skip||y.update(c)||(y.skip=!0)}if(this.emit("update",f,h),1===f||a&&0===f){if(p){isFinite(p)&&this._repeat--,this.emit(a?"reverse":"repeat"),u&&(this._reversed=!a),this._startTime+=!a&&i?r+i:a&&o?r+o:r;for(var d in n){var _=n[d];_.skip&&(_.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}(k),C=function(t){return t};t.Plugins=_,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=C);var o=t.events,s=t.instance,a=new k(e,s).to(n,r).easing(i);o&&(a._events=o),t.start=a.start.bind(a)},t.Interpolator=E,t.nextId=h,t.has=function(t){return null!==c(t)},t.get=c,t.getAll=function(){return r},t.removeAll=function(){for(var t in r)r[+t]=null,delete r[+t];r.length=0},t.remove=l,t.add=f,t.now=y,t.update=d,t.autoPlay=function(t){o=t},t.Tween=k,t.Easing=g,t.Interpolation=b,t.Timeline=S,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=dist/Tween.min.js.map
//# sourceMappingURL=Tween.min.js.map
{
"name": "es6-tween",
"version": "3.0.1",
"version": "3.0.2",
"description": "ES6 implementation of amazing tween.js",

@@ -19,3 +19,3 @@ "browser": "dist/Tween.min.js",

"test": "nodeunit test/unit/nodeunitheadless.js",
"check": "npm run lint && npm test"
"prepublishOnly": "npm run lint && npm test && npm run build"
},

@@ -22,0 +22,0 @@ "repository": {

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