es6-tween
Advanced tools
Comparing version 5.5.5 to 5.5.6
@@ -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=t||self).TWEEN={})}(this,function(t){"use strict";function s(t){var e=u.indexOf(t);-1<e&&u.splice(e,1),u.push(t),p=0,l&&!f&&(o=c(i),f=!0)}function e(t){for(var e=0;e<u.length;e++)if(t===u[e])return u[e];return null}function F(){return f}function x(){return v}var o,r="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this||(void 0!==t?t:{}),n=r.requestAnimationFrame||function(t){return r.setTimeout(t,50/3)},a=r.cancelAnimationFrame||function(t){return r.clearTimeout(t)},C=function(){if("undefined"==typeof process||void 0===process.hrtime||process.versions&&void 0!==process.versions.electron){if(void 0!==r.performance&&void 0!==r.performance.now)return r.performance.now.bind(r.performance);var t=r.performance&&r.performance.timing&&r.performance.timing.navigationStart?r.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}return function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}}(),u=[],f=!1,l=!1,h=[],c=n,p=0,d=120,v=!0,N=function(t){var e=u.indexOf(t);-1!==e&&u.splice(e,1),0===u.length&&(a(o),f=!1)},i=function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:C(),r=1<arguments.length?arguments[1]:void 0;if(d<=p&&v)return f=!1,p=0,a(o),!1;l&&f?o=c(t):function(){for(var t=0;t<h.length;t++)h[t]()}(),u.length||p++;for(var n=0,i=u.length;n<i;)u[n++].update(e,r),i>u.length&&n--,i=u.length;return!0},q={},y={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return Math.pow(t,2)},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*Math.pow(t,2):-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return Math.pow(t,3)},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*Math.pow(t,3):.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return Math.pow(t,4)},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*Math.pow(t,4):-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return Math.pow(t,5)},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*Math.pow(t,5):.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){return t*t*(2.70158*t-1.70158)},Out:function(t){return--t*t*(2.70158*t+1.70158)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((1+e)*t-e)*.5:.5*((t-=2)*t*((1+e)*t+e)+2)}},Bounce:{In:function(t){return 1-y.Bounce.Out(1-t)},Out:function(t){var e=2.75,r=7.5625;return t<1/e?r*t*t:t<2/e?r*(t-=1.5/e)*t+.75:t<2.5/e?r*(t-=2.25/e)*t+.9375:r*(t-=2.625/e)*t+.984375},InOut:function(t){return t<.5?.5*y.Bounce.In(2*t):.5*y.Bounce.Out(2*t-1)+.5}},Stepped:{steps:function(e){return function(t){return(t*e|0)/e}}}};function m(t){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function b(t,e,r){return e&&g(t.prototype,e),r&&g(t,r),t}function T(i){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},e=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),e.forEach(function(t){var e,r,n;e=i,n=o[r=t],r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n})}return i}function k(t){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function w(t,e){return(w=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function O(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function j(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?O(t):e}function A(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var D=50/3,U="_chainedTweens",E="Callback",V="update",B="complete",G="start",z="repeat",Q="reverse",S="restart",M="STRING_PROP",P=/\s+|([A-Za-z?().,{}:""[\]#%]+)|([-+]=+)?([-+]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]=?\d+)?/g;function R(t){if(t&&t.nodeType||void 0===t||"object"!==m(t))return t;if(Array.isArray(t))return[].concat(t);if("object"!==m(t))return t;var e={};for(var r in t)e[r]=R(t[r]);return e}var I=function(t){return isNaN(+t)||("+"===t[0]||"-"===t[0])&&"="===t[1]||""===t||" "===t},L=/^#([0-9a-f]{6}|[0-9a-f]{3})$/gi,K=function(t,e){var r,n,i;3===e.length&&(e=(r=e[0])+r+(n=e[1])+n+(i=e[2])+i);var o=parseInt(e,16);return"rgb("+(r=o>>16&255)+", "+(n=o>>8&255)+", "+(i=255&o)+")"};function W(t){return"string"!=typeof t?t:t.replace(L,K).match(P).map(function(t){return I(t)?t:+t})}function H(r,n,t,e,i){var o=t[r],s=e[r];if("string"==typeof o&&Array.isArray(s)){var a=W(o),u=s.map(W);return a.isString=!0,t[r]=a,e[r]=u,!0}if("string"==typeof o||"string"==typeof s){for(var f=Array.isArray(o)&&o[0]===M?o:W(o),l=Array.isArray(s)&&s[0]===M?s:W(s),h=1;h<f.length;)f[h]===l[h]&&"string"==typeof f[h-1]?(f.splice(h-1,2,f[h-1]+f[h]),l.splice(h-1,2,l[h-1]+l[h])):h++;return f[h=0]===M&&f.shift(),l[0]===M&&l.shift(),f.isString=!0,l.isString=!0,t[r]=f,e[r]=l,!0}if("object"!==m(o)||"object"!==m(s))return!1;if(Array.isArray(o))return o.map(function(t,e){return H(e,n[r],o,s)});for(var c in s)H(c,n[r],o,s);return!0}var X="rgba(",Y=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgb(";return"number"==typeof t[e]&&(t[e-1]===r||t[e-3]===r||t[e-5]===r)};function Z(t,e,r,n,i,o,s){var a=s?r:r[t],u=s?n:n[t];if(void 0===u)return a;if(void 0===a||"string"==typeof a||a===u)return u;if("object"===m(a)&&"object"===m(u)){if(!a||!u)return e[t];if("object"===m(a)&&a&&a.isString){for(var f="",l=0,h=a.length;l<h;l++){var c="number"==typeof a[l]&&"string"==typeof u[l]&&"="===u[l][1],p="number"!=typeof a[l]?a[l]:c?a[l]+parseFloat(u[l][0]+u[l].substr(2))*i:a[l]+(u[l]-a[l])*i;(Y(a,l)||Y(a,l,X))&&(p|=0),f+=p,c&&1===o&&(a[l]=a[l]+parseFloat(u[l][0]+u[l].substr(2)))}return s||(e[t]=f),f}if(Array.isArray(a)&&a[0]!==M)for(var d=0,v=a.length;d<v;d++)a[d]!==u[d]&&Z(d,e[t],a,u,i,o);else if("object"===m(a)&&a&&!a.isString)for(var y in a)a[y]!==u[y]&&Z(y,e[t],a,u,i,o)}else if("number"==typeof a){var _="string"==typeof u;e[t]=_?a+parseFloat(u[0]+u.substr(2))*i:a+(u-a)*i,_&&1===o&&(r[t]=e[t])}else"function"==typeof u&&(e[t]=u(i));return e[t]}function $(t,e){var i=t[e],o=e.replace(rt,"").split(et),s=o.length-1,a=Array.isArray(t),u="object"===m(t)&&!a;return u?(t[e]=null,delete t[e]):a&&t.splice(e,1),o.reduce(function(t,e,r){a&&"."!==e&&"["!==e&&(e*=1);var n="["===o[r+1];if("."===e||"["===e)return"."===e?a=!(u=!0):"["===e&&(a=!(u=!1)),t;if(void 0===t[e]){if(a||u)return t[e]=r===s?i:a||n?[]:u?{}:null,u=a=!1,t[e]}else if(void 0!==t[e])return r===s&&(t[e]=i),t[e];return t},t)}function J(t){if("object"===m(t)&&t)for(var e in t)if(-1!==e.indexOf(".")||-1!==e.indexOf("["))$(t,e);else if("object"===m(t[e])&&t[e]){var r=t[e];for(var n in r)if(-1!==n.indexOf(".")||-1!==n.indexOf("["))$(r,n);else if("object"===m(r[n])&&r[n]){var i=r[n];for(var o in i)-1===o.indexOf(".")&&-1===o.indexOf("[")||$(i,o)}}return t}var tt,et=/([.[])/g,rt=/\]/g,nt=Object.freeze({FRAME_MS:D,TOO_LONG_FRAME_MS:250,CHAINED_TWEENS:U,EVENT_CALLBACK:E,EVENT_UPDATE:V,EVENT_COMPLETE:B,EVENT_START:G,EVENT_REPEAT:z,EVENT_REVERSE:Q,EVENT_PAUSE:"pause",EVENT_PLAY:"play",EVENT_RESTART:S,EVENT_STOP:"stop",EVENT_SEEK:"seek",STRING_PROP:M,NUM_REGEX:P,deepCopy:R,decomposeString:W,decompose:H,RGB:"rgb(",RGBA:X,isRGBColor:Y,recompose:Z,SET_NESTED:J}),it={Linear:function(t,e,r){var n=t.length-1,i=n*e,o=Math.floor(i),s=it.Utils.Linear;return e<0?s(t[0],t[1],i,r):1<e?s(t[n],t[n-1],n-i,r):s(t[o],t[n<o+1?n:o+1],i-o,r)},Bezier:function(t,e,r){for(var n=it.Utils.Reset(r),i=t.length-1,o=Math.pow,s=it.Utils.Bernstein,a=Array.isArray(n),u=0;u<=i;u++)if("number"==typeof n)n+=o(1-e,i-u)*o(e,u)*t[u]*s(i,u);else if(a)for(var f=0,l=n.length;f<l;f++)"number"==typeof n[f]?n[f]+=o(1-e,i-u)*o(e,u)*t[u][f]*s(i,u):n[f]=t[u][f];else if("object"===m(n))for(var h in n)"number"==typeof n[h]?n[h]+=o(1-e,i-u)*o(e,u)*t[u][h]*s(i,u):n[h]=t[u][h];else if("string"==typeof n){for(var c="",p=t[Math.round(i*e)],d=1,v=p.length;d<v;d++)c+=p[d];return c}return n},CatmullRom:function(t,e,r){var n=t.length-1,i=n*e,o=Math.floor(i),s=it.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(o=Math.floor(i=n*(1+e))),s(t[(o-1+n)%n],t[o],t[(o+1)%n],t[(o+2)%n],i-o,r)):e<0?s(t[1],t[1],t[0],t[0],-e,r):1<e?s(t[n-1],t[n-1],t[n],t[n],(0|e)-e,r):s(t[o?o-1:0],t[o],t[n<o+1?n:o+1],t[n<o+2?n:o+2],i-o,r)},Utils:{Linear:function(t,e,r,n){if(t===e||"string"==typeof t){if(e.length&&e.splice&&e.isString){e="";for(var i=0,o=t.length;i<o;i++)e+=t[i]}return e}if("number"==typeof t)return"function"==typeof t?t(r):t+(e-t)*r;if("object"===m(t)){if(void 0!==t.length){var s="string"==typeof t[0]||t.isString;if(s||t[0]===M){for(var a="",u=s?0:1,f=t.length;u<f;u++){var l=0===r?t[u]:1===r?e[u]:"number"==typeof t[u]?t[u]+(e[u]-t[u])*r:e[u];(0<r&&r<1&&Y(t,u)||Y(t,u,X))&&(l|=0),a+=l}return a}if(n&&n.length&&n.splice)for(var h=0,c=n.length;h<c;h++)n[h]=it.Utils.Linear(t[h],e[h],r,n[h])}else for(var p in n)n[p]=it.Utils.Linear(t[p],e[p],r,n[p]);return n}},Reset:function(t){if(Array.isArray(t)){for(var e=0,r=t.length;e<r;e++)t[e]=it.Utils.Reset(t[e]);return t}if("object"!==m(t))return"number"==typeof t?0:t;for(var n in t)t[n]=it.Utils.Reset(t[n]);return t},Bernstein:function(t,e){var r=it.Utils.Factorial;return r(t)/r(e)/r(t-e)},Factorial:(tt=[1],function(t){var e=1;if(tt[t])return tt[t];for(var r=t;1<r;r--)e*=r;return tt[t]=e}),CatmullRom:function(t,e,r,n,i,o){if("string"==typeof t)return e;if("number"==typeof t){var s=.5*(r-t),a=.5*(n-e),u=i*i;return(2*e-2*r+s+a)*(i*u)+(-3*e+3*r-2*s-a)*u+s*i+e}if("object"===m(t)){if(void 0!==t.length){if(t[0]===M){for(var f="",l=1,h=t.length;l<h;l++){var c="number"==typeof t[l]?it.Utils.CatmullRom(t[l],e[l],r[l],n[l],i):n[l];(Y(t,l)||Y(t,l,X))&&(c|=0),f+=c}return f}for(var p=0,d=o.length;p<d;p++)o[p]=it.Utils.CatmullRom(t[p],e[p],r[p],n[p],i,o[p])}else for(var v in o)o[v]=it.Utils.CatmullRom(t[v],e[v],r[v],n[v],i,o[v]);return o}}}},ot={};function st(t,e,r){if(!t||!t.nodeType)return e;var n=t.queueID||"q_"+Date.now();t.queueID||(t.queueID=n);var i=ot[n];if(i){if(i.object===e&&t===i.tween.node&&r._startTime===i.tween._startTime)N(i.tween);else if("object"===m(e)&&e&&i.object){for(var o in e)o in i.object&&(r._startTime===i.tween._startTime?delete i.object[o]:i.propNormaliseRequired=!0);Object.assign(i.object,e)}return i.object}return"object"===m(e)&&e?(ot[n]={tween:r,object:e,propNormaliseRequired:!1},ot[n].object):e}function at(t,e,r){return e?t?"undefined"!=typeof window&&t===window||"undefined"!=typeof document&&t===document?[t]:"string"==typeof t?!!document.querySelectorAll&&document.querySelectorAll(t):Array.isArray(t)?t:t.nodeType?[t]:r?t:[]:null:t?"undefined"!=typeof window&&t===window||"undefined"!=typeof document&&t===document?t:"string"==typeof t?!!document.querySelector&&document.querySelector(t):Array.isArray(t)?t[0]:t.nodeType?t:r?t:null:null}var ut=0,ft=y.Linear.None,lt=function(){function L(t,e){return _(this,L),this.id=ut++,!t||"object"!==m(t)||e||t.nodeType?t&&(t.nodeType||t.length||"string"==typeof t)&&(t=this.node=at(t),e=this.object=st(t,e,this)):(e=this.object=t,t=null),this._valuesEnd=null,this._valuesStart=Array.isArray(e)?[]:{},this._duration=1e3,this._easingFunction=ft,this._easingReverse=ft,this._interpolationFunction=it.Linear,this._startTime=0,this._initTime=0,this._delayTime=0,this._repeat=0,this._r=0,this._isPlaying=!1,this._yoyo=!1,this._reversed=!1,this._onStartCallbackFired=!1,this._pausedTime=null,this._isFinite=!0,this._maxListener=15,this._chainedTweensCount=0,this._prevTime=null,this}return b(L,null,[{key:"fromTo",value:function(t,e,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};n.quickRender=n.quickRender?n.quickRender:!r;var i=new L(t,e).to(r,n);return n.quickRender&&(i.render().update(i._startTime),i._rendered=!1,i._onStartCallbackFired=!1),i}},{key:"to",value:function(t,e,r){return L.fromTo(t,null,e,r)}},{key:"from",value:function(t,e,r){return L.fromTo(t,e,null,r)}}]),b(L,[{key:"setMaxListener",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:15;return this._maxListener=t,this}},{key:"on",value:function(t,e){for(var r=this._maxListener,n=t+E,i=0;i<r;i++){var o=n+i;if(!this[o]){this[o]=e;break}}return this}},{key:"once",value:function(t,i){for(var o=this,e=this._maxListener,r=t+E,n=function(t){var n=r+t;if(!o[n])return o[n]=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];i.apply(o,e),o[n]=null},"break"},s=0;s<e;s++){if("break"===n(s))break}return this}},{key:"off",value:function(t,e){for(var r=this._maxListener,n=t+E,i=0;i<r;i++){var o=n+i;this[o]===e&&(this[o]=null)}return this}},{key:"emit",value:function(t,e,r,n){var i=this._maxListener,o=t+E;if(!this[o+0])return this;for(var s=0;s<i;s++){var a=o+s;this[a]&&this[a](e,r,n)}return this}},{key:"isPlaying",value:function(){return this._isPlaying}},{key:"isStarted",value:function(){return this._onStartCallbackFired}},{key:"reverse",value:function(t){var e=this._reversed;return this._reversed=void 0!==t?t:!e,this}},{key:"reversed",value:function(){return this._reversed}},{key:"pause",value:function(){return this._isPlaying?(this._isPlaying=!1,N(this),this._pausedTime=C(),this.emit("pause",this.object)):this}},{key:"play",value:function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=C()-this._pausedTime,this._initTime=this._startTime,s(this),this._pausedTime=C(),this.emit("play",this.object))}},{key:"restart",value:function(t){return this._repeat=this._r,this.reassignValues(),s(this),this.emit(S,this.object)}},{key:"seek",value:function(t,e){var r=this._duration,n=this._initTime,i=this._startTime,o=this._reversed,s=n+t;return this._isPlaying=!0,s<i&&n<=i&&(this._startTime-=r,this._reversed=!o),this.update(t,!1),this.emit("seek",t,this.object),e?this:this.pause()}},{key:"duration",value:function(t){return this._duration="function"==typeof t?t(this._duration):t,this}},{key:"to",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e3;if(this._valuesEnd=t,"number"==typeof e||"function"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"===m(e))for(var r in e)if("function"==typeof this[r]){var n=A(Array.isArray(e[r])?e[r]:[e[r]],4),i=n[0],o=void 0===i?null:i,s=n[1],a=void 0===s?null:s,u=n[2],f=void 0===u?null:u,l=n[3],h=void 0===l?null:l;this[r](o,a,f,h)}return this}},{key:"render",value:function(){if(this._rendered)return this;var t=this._valuesStart,e=this._valuesEnd,r=this.object,n=this.node,i=this.InitialValues;if(J(r),J(e),n&&n.queueID&&ot[n.queueID]){var o=ot[n.queueID];if(o.propNormaliseRequired&&o.tween!==this){for(var s in e)o.tween._valuesEnd[s];o.normalisedProp=!0,o.propNormaliseRequired=!1}}for(var a in n&&i&&(r&&0!==Object.keys(r).length?e&&0!==Object.keys(e).length||(e=this._valuesEnd=i(n,r)):r=this.object=st(n,i(n,e),this)),e){var u=r&&r[a]&&R(r[a]),f=e[a];if(!(q[a]&&q[a].init&&(q[a].init.call(this,u,f,a,r),void 0===u&&t[a]&&(u=t[a]),q[a].skipProcess))&&!("number"==typeof u&&isNaN(u)||null===u||null===f||!1===u||!1===f||void 0===u||void 0===f||u===f)){if(Array.isArray(f)&&!Array.isArray(u)){f.unshift(u);for(var l=0,h=f.length;l<h;l++)if("string"==typeof f[l]){var c=W(f[l]);c.isString=!0,f[l]=c}}"number"==typeof(t[a]=u)&&"string"==typeof f&&"="===f[1]||H(a,r,t,e)}}return L.Renderer&&this.node&&L.Renderer.init&&(L.Renderer.init.call(this,r,t,e),this.__render=!0),this}},{key:"start",value:function(t){return this._startTime=void 0!==t?"string"==typeof t?C()+parseFloat(t):t:C(),this._startTime+=this._delayTime,this._initTime=this._prevTime=this._startTime,this._onStartCallbackFired=!1,this._rendered=!1,this._isPlaying=!0,s(this),this}},{key:"stop",value:function(){var t=this._isPlaying,e=this._isFinite,r=this.object,n=this._startTime,i=this._duration,o=this._r,s=this._yoyo,a=this._reversed;if(!t)return this;var u=e?(o+1)%2==1:!a;return this._reversed=!1,s&&u?this.update(n):this.update(n+i),N(this),this.emit("stop",r)}},{key:"delay",value:function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this}},{key:"chainedTweens",value:function(){if(this._chainedTweensCount=arguments.length,!this._chainedTweensCount)return this;for(var t=0,e=this._chainedTweensCount;t<e;t++)this[U+t]=arguments[t];return this}},{key:"repeat",value:function(t){return this._repeat=this._duration?"function"==typeof t?t(this._repeat):t:0,this._r=this._repeat,this._isFinite=isFinite(t),this}},{key:"reverseDelay",value:function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this}},{key:"yoyo",value:function(t,e){return this._yoyo="function"==typeof t?t(this._yoyo):null===t?this._yoyo:t,t||(this._reversed=!1),this._easingReverse=e||null,this}},{key:"easing",value:function(t){return this._easingFunction=t,this}},{key:"interpolation",value:function(t){return"function"==typeof t&&(this._interpolationFunction=t),this}},{key:"reassignValues",value:function(t){var e=this._valuesStart,r=this.object,n=this._delayTime;for(var i in this._isPlaying=!0,this._startTime=void 0!==t?t:C(),this._startTime+=n,this._reversed=!1,s(this),e){var o=e[i];r[i]=o}return this}},{key:"update",value:function(t,e,r){var n,i,o,s=this._onStartCallbackFired,a=this._easingFunction,u=this._interpolationFunction,f=this._easingReverse,l=this._repeat,h=this._delayTime,c=this._reverseDelayTime,p=this._yoyo,d=this._reversed,v=this._startTime,y=this._prevTime,_=this._duration,m=this._valuesStart,g=this._valuesEnd,b=this.object,T=this._isFinite,k=this._isPlaying,w=this.__render,O=this._chainedTweensCount,j=0;if(_){var A=(t=void 0!==t?t:C())-y;if(this._prevTime=t,250<A&&F()&&x()&&(t-=A-D),!k||t<v&&!r)return!0;n=1<(n=(t-v)/_)?1:n,n=d?1-n:n}else n=1,l=0;if(s||(this._rendered||(this.render(),this._rendered=!0),this.emit(G,b),this._onStartCallbackFired=!0),i=d&&f||a,!b)return!0;for(o in g){var E=m[o];if(null!=E||q[o]&&q[o].update){var S=g[o],M=i[o]?i[o](n):"function"==typeof i?i(n):ft(n),P=u[o]?u[o]:"function"==typeof u?u:it.Linear;"number"==typeof S?b[o]=E+(S-E)*M:!Array.isArray(S)||S.isString||Array.isArray(E)&&!E.isString?S&&S.update?S.update(M):"function"==typeof S?b[o]=S(M):"string"==typeof S&&"number"==typeof E?b[o]=E+parseFloat(S[0]+S.substr(2))*M:Z(o,b,m,g,M,n):b[o]=P(S,M,b[o]),q[o]&&q[o].update&&q[o].update.call(this,b[o],E,S,M,n,o),j++}}if(!j)return N(this),!1;if(w&&L.Renderer&&L.Renderer.update&&L.Renderer.update.call(this,b,n),this.emit(V,b,n,t),1===n||d&&0===n){if(0<l&&0<_){if(T&&this._repeat--,p)this._reversed=!d;else for(o in g){var R=g[o];"string"==typeof R&&"number"==typeof m[o]&&(m[o]+=parseFloat(R[0]+R.substr(2)))}return this.emit(p&&!d?Q:z,b),this._startTime=d&&c?t-c:t+h,!0}if(e||(this._isPlaying=!1,N(this),ut--),this.emit(B,b),this._repeat=this._r,O)for(var I=0;I<O;I++)this[U+I].start(t+_);return!1}return!0}}]),L}(),ht=function(){function t(){_(this,t),this.totalTime=0,this.labels=[],this.offsets=[]}return b(t,[{key:"parseLabel",value:function(t,e){var r=this.offsets,n=this.labels,i=n.indexOf(t);if("string"==typeof t&&-1!==t.indexOf("=")&&!e&&-1===i){var o=t.substr(t.indexOf("=")-1,2),s=t.split(o);e=2===s.length?o+s[1]:null,t=s[0],i=n.indexOf(t)}if(-1!==i&&t){var a=r[i]||0;if("number"==typeof e)a=e;else if("string"==typeof e&&-1!==e.indexOf("=")){var u=e.charAt(0);e=Number(e.substr(2)),"+"===u||"-"===u?a+=parseFloat(u+e):"*"===u?a*=e:"/"===u?a/=e:"%"===u&&(a*=e/100)}return a}return"number"==typeof e?e:0}},{key:"addLabel",value:function(t,e){return this.labels.push(t),this.offsets.push(this.parseLabel(t,e)),this}},{key:"setLabel",value:function(t,e){var r=this.labels.indexOf(t);return-1!==r&&this.offsets.splice(r,1,this.parseLabel(t,e)),this}},{key:"eraseLabel",value:function(t){var e=this.labels.indexOf(t);return-1!==e&&(this.labels.splice(e,1),this.offsets.splice(e,1)),this}}]),t}(),ct=0,pt=function(t){function r(t){var e;return _(this,r),(e=j(this,k(r).call(this)))._duration=0,e._startTime=t&&void 0!==t.startTime?t.startTime:C(),e._tweens=[],e.elapsed=0,e._id=ct++,e._defaultParams=t,e.position=new ht,e.position.addLabel("afterLast",e._duration),e.position.addLabel("afterInit",e._startTime),e._onStartCallbackFired=!1,j(e,O(e))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&w(t,e)}(r,lt),b(r,[{key:"mapTotal",value:function(t){return t.call(this,this._tweens),this}},{key:"timingOrder",value:function(t){var r=t(this._tweens.map(function(t){return t._startTime}));return this._tweens.map(function(t,e){t._startTime=r[e]}),this}},{key:"getTiming",value:function(t,e,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;if("reverse"===t){var i=r.stagger,o=(i||0)*(e.length-1);return e.map(function(t,e){return o-(i||0)*e+n})}if("async"===t)return e.map(function(t){return n});if("sequence"===t||"delayed"===t){var s=r.stagger;return s||(s=(r.duration||1e3)/(e.length-1)),e.map(function(t,e){return s*e+n})}if("oneByOne"===t)return e.map(function(t){return r.duration});if("shuffle"===t){var a=r.stagger;return function(t){var e,r,n;for(n=t.length;n;n-=1)e=Math.floor(Math.random()*n),r=t[n-1],t[n-1]=t[e],t[e]=r;return t}(e.map(function(t,e){return(a||0)*e+n}))}var u=r.stagger;return e.map(function(t,e){return(u||0)*e+n})}},{key:"fromTo",value:function(t,e,r,n){if((t=at(t,!0,!0))&&t.length){this._defaultParams&&(n=n?T({},this._defaultParams,n):this._defaultParams);for(var i,o=n.label,s="number"==typeof o?o:this.position.parseLabel(void 0!==o?o:"afterLast",null),a=this.getTiming(n.mode,t,n,s),u=0,f=t.length;u<f;u++)i=t[u],this.add(lt.fromTo(i,"function"==typeof e?e(u,t.length):"object"===m(e)&&e?T({},e):null,"function"==typeof r?r(u,t.length):r,"function"==typeof n?n(u,t.length):n),a[u])}return this.start()}},{key:"from",value:function(t,e,r){return this.fromTo(t,e,null,r)}},{key:"to",value:function(t,e,r){return this.fromTo(t,null,e,r)}},{key:"addLabel",value:function(t,e){return this.position.addLabel(t,e),this}},{key:"map",value:function(t){for(var e=0,r=this._tweens.length;e<r;e++){var n=this._tweens[e];t(n,e),this._duration=Math.max(this._duration,n._duration+n._startTime)}return this}},{key:"add",value:function(t,e){var r=this;if(Array.isArray(t))return t.map(function(t){r.add(t,e)}),this;"object"!==m(t)||t instanceof lt||(t=new lt(t.from).to(t.to,t));var n=this._defaultParams,i=this._duration;if(n)for(var o in n)"function"==typeof t[o]&&t[o](n[o]);var s="number"==typeof e?e:this.position.parseLabel(void 0!==e?e:"afterLast",null);return t._startTime=Math.max(this._startTime,t._delayTime,s),t._delayTime=s,t._isPlaying=!0,this._duration=Math.max(i,Math.max(t._startTime+t._delayTime,t._duration)),this._tweens.push(t),this.position.setLabel("afterLast",this._duration),this}},{key:"restart",value:function(){return this._startTime+=C(),s(this),this.emit(S)}},{key:"easing",value:function(e){return this.map(function(t){return t.easing(e)})}},{key:"interpolation",value:function(e){return this.map(function(t){return t.interpolation(e)})}},{key:"update",value:function(t){var e,r=this._tweens,n=this._duration,i=this._reverseDelayTime,o=this._startTime,s=this._reversed,a=this._yoyo,u=this._repeat,f=this._isFinite,l=this._isPlaying,h=this._prevTime,c=this._onStartCallbackFired,p=(t=void 0!==t?t:C())-h;if(this._prevTime=t,250<p&&F()&&x()&&(t-=p-D),!l||t<o)return!0;e=1<(e=(t-o)/n)?1:e,e=s?1-e:e,this.elapsed=e,c||(this.emit(G),this._onStartCallbackFired=!0);for(var d=t-o,v=s?n-d:d,y=0;y<r.length;)r[y].update(v),y++;if(this.emit(V,e,d),1===e||s&&0===e){if(u){for(f&&this._repeat--,this.emit(s?Q:z),a&&(this._reversed=!s,this.timingOrder(function(t){return t.reverse()})),this._startTime=s&&i?t+i:t,y=0;y<r.length;)r[y].reassignValues(t),y++;return!0}return this.emit(B),this._repeat=this._r,N(this),this._isPlaying=!1}return!0}},{key:"progress",value:function(t){return void 0!==t?this.update(t*this._duration):this.elapsed}}]),r}();t.Easing=y,t.FrameThrottle=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:120;d=1.05*t},t.Interpolation=it,t.Interpolator=function(i,o){var s=Array.isArray(i)&&!i.isString,a="string"==typeof i?i:s?i.slice():T({},i);if(s)for(var t=0,e=i.length;t<e;t++)H(t,a,i,o);else if("object"===m(i))for(var r in i)H(r,a,i,o);else if("string"==typeof i){i=W(i),o=W(o);for(var n=1;n<i.length;)i[n]===o[n]&&"string"==typeof i[n-1]?(i.splice(n-1,2,i[n-1]+i[n]),o.splice(n-1,2,o[n-1]+o[n])):n++;i.isString=!0,o.isString=!0}return function(t){if(s)for(var e=0,r=i.length;e<r;e++)Z(e,a,i,o,t);else if("object"===m(a))for(var n in i)Z(n,a,i,o,t);else"string"==typeof a&&(a=Z(0,0,i,o,t,t,!0));return a}},t.Plugins=q,t.Selector=at,t.Timeline=pt,t.ToggleLagSmoothing=function(){var t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];v=t},t.Tween=lt,t.add=s,t.autoPlay=function(t){l=t},t.get=e,t.getAll=function(){return u},t.has=function(t){return null!==e(t)},t.isRunning=F,t.now=C,t.onRequestTick=function(t){h.push(t)},t.onTick=function(t){return u.push({update:t})},t.remove=N,t.removeAll=function(){u.length=0,a(o),f=!1},t.update=i,t.utils=nt,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=t||self).TWEEN={})}(this,function(t){"use strict";function s(t){var e=u.indexOf(t);-1<e&&u.splice(e,1),u.push(t),p=0,l&&!f&&(o=c(i),f=!0)}function e(t){for(var e=0;e<u.length;e++)if(t===u[e])return u[e];return null}function F(){return f}function x(){return d}var o,r="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this||(void 0!==t?t:{}),n=r.requestAnimationFrame||function(t){return r.setTimeout(t,50/3)},a=r.cancelAnimationFrame||function(t){return r.clearTimeout(t)},C=function(){if("undefined"==typeof process||void 0===process.hrtime||process.versions&&void 0!==process.versions.electron){if(void 0!==r.performance&&void 0!==r.performance.now)return r.performance.now.bind(r.performance);var t=r.performance&&r.performance.timing&&r.performance.timing.navigationStart?r.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}return function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}}(),u=[],f=!1,l=!1,h=[],c=n,p=0,y=120,d=!0,N=function(t){var e=u.indexOf(t);-1!==e&&u.splice(e,1),0===u.length&&(a(o),f=!1)},i=function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:C(),r=1<arguments.length?arguments[1]:void 0;if(y<=p&&d)return f=!1,p=0,a(o),!1;l&&f?o=c(t):function(){for(var t=0;t<h.length;t++)h[t]()}(),u.length||p++;for(var n=0,i=u.length;n<i;)u[n++].update(e,r),i>u.length&&n--,i=u.length;return!0},q={},v={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return Math.pow(t,2)},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*Math.pow(t,2):-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return Math.pow(t,3)},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*Math.pow(t,3):.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return Math.pow(t,4)},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*Math.pow(t,4):-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return Math.pow(t,5)},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*Math.pow(t,5):.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){return t*t*(2.70158*t-1.70158)},Out:function(t){return--t*t*(2.70158*t+1.70158)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((1+e)*t-e)*.5:.5*((t-=2)*t*((1+e)*t+e)+2)}},Bounce:{In:function(t){return 1-v.Bounce.Out(1-t)},Out:function(t){var e=2.75,r=7.5625;return t<1/e?r*t*t:t<2/e?r*(t-=1.5/e)*t+.75:t<2.5/e?r*(t-=2.25/e)*t+.9375:r*(t-=2.625/e)*t+.984375},InOut:function(t){return t<.5?.5*v.Bounce.In(2*t):.5*v.Bounce.Out(2*t-1)+.5}},Stepped:{steps:function(e){return function(t){return(t*e|0)/e}}}};function m(t){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function b(t,e,r){return e&&g(t.prototype,e),r&&g(t,r),t}function T(i){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},e=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),e.forEach(function(t){var e,r,n;e=i,n=o[r=t],r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n})}return i}function k(t){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function w(t,e){return(w=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function O(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function S(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?O(t):e}function j(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var D=50/3,U="_chainedTweens",A="Callback",V="update",B="complete",G="start",z="repeat",Q="reverse",E="restart",M="STRING_PROP",P=/\s+|([A-Za-z?().,{}:""[\]#%]+)|([-+]=+)?([-+]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]=?\d+)?/g;function R(t){if(t&&t.nodeType||void 0===t||"object"!==m(t))return t;if(Array.isArray(t))return[].concat(t);if("object"!==m(t))return t;var e={};for(var r in t)e[r]=R(t[r]);return e}var I=function(t){return isNaN(+t)||("+"===t[0]||"-"===t[0])&&"="===t[1]||""===t||" "===t},L=/^#([0-9a-f]{6}|[0-9a-f]{3})$/gi,K=function(t,e){var r,n,i;3===e.length&&(e=(r=e[0])+r+(n=e[1])+n+(i=e[2])+i);var o=parseInt(e,16);return"rgb("+(r=o>>16&255)+", "+(n=o>>8&255)+", "+(i=255&o)+")"};function W(t){if(t&&t.splice&&t.isString)return t;var e="string"!=typeof t?t:t.replace(L,K).match(P).map(function(t){return I(t)?t:+t});return e.isString=!0,e}function H(r,n,t,e,i){var o=t[r],s=e[r];if("number"==typeof o&&"number"==typeof s);else if(o&&o.splice&&o.isString&&s&&s.splice&&s.isString);else{if("string"==typeof o&&Array.isArray(s)){var a=W(o),u=s.map(W);return t[r]=a,e[r]=u,!0}if("string"==typeof o||"string"==typeof s){for(var f=Array.isArray(o)&&o[0]===M?o:W(o),l=Array.isArray(s)&&s[0]===M?s:W(s),h=1;h<f.length;)f[h]===l[h]&&"string"==typeof f[h-1]?(f.splice(h-1,2,f[h-1]+f[h]),l.splice(h-1,2,l[h-1]+l[h])):h++;return f[h=0]===M&&f.shift(),l[0]===M&&l.shift(),t[r]=f,e[r]=l,!0}if("object"===m(o)&&"object"===m(s)){if(Array.isArray(o)&&!o.isString)return o.map(function(t,e){return H(e,n[r],o,s)});for(var c in s)H(c,n[r],o,s);return!0}}return!1}var X="rgba(",Y=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgb(";return"number"==typeof t[e]&&(t[e-1]===r||t[e-3]===r||t[e-5]===r)};function Z(t,e,r,n,i,o,s){var a=s?r:r[t],u=s?n:n[t];if(void 0===u)return a;if(void 0===a||"string"==typeof a||a===u)return u;if("object"===m(a)&&"object"===m(u)){if(!a||!u)return e[t];if("object"===m(a)&&a&&a.isString&&u&&u.splice&&u.isString){for(var f="",l=0,h=a.length;l<h;l++)if(a[l]!==u[l]||"number"!=typeof a[l]||"number"==typeof u[l]){var c="number"==typeof a[l]&&"string"==typeof u[l]&&"="===u[l][1],p="number"!=typeof a[l]?a[l]:c?a[l]+parseFloat(u[l][0]+u[l].substr(2))*i:a[l]+(u[l]-a[l])*i;(Y(a,l)||Y(a,l,X))&&(p|=0),f+=p,c&&1===o&&(a[l]=a[l]+parseFloat(u[l][0]+u[l].substr(2)))}else f+=a[l];return s||(e[t]=f),f}if(Array.isArray(a)&&a[0]!==M)for(var y=0,d=a.length;y<d;y++)a[y]!==u[y]&&Z(y,e[t],a,u,i,o);else if("object"===m(a)&&a&&!a.isString)for(var v in a)a[v]!==u[v]&&Z(v,e[t],a,u,i,o)}else if("number"==typeof a){var _="string"==typeof u;e[t]=_?a+parseFloat(u[0]+u.substr(2))*i:a+(u-a)*i,_&&1===o&&(r[t]=e[t])}else"function"==typeof u&&(e[t]=u(i));return e[t]}function $(t,e){var i=t[e],o=e.replace(rt,"").split(et),s=o.length-1,a=Array.isArray(t),u="object"===m(t)&&!a;return u?(t[e]=null,delete t[e]):a&&t.splice(e,1),o.reduce(function(t,e,r){a&&"."!==e&&"["!==e&&(e*=1);var n="["===o[r+1];if("."===e||"["===e)return"."===e?a=!(u=!0):"["===e&&(a=!(u=!1)),t;if(void 0===t[e]){if(a||u)return t[e]=r===s?i:a||n?[]:u?{}:null,u=a=!1,t[e]}else if(void 0!==t[e])return r===s&&(t[e]=i),t[e];return t},t)}function J(t){if("object"===m(t)&&t)for(var e in t)if(-1!==e.indexOf(".")||-1!==e.indexOf("["))$(t,e);else if("object"===m(t[e])&&t[e]){var r=t[e];for(var n in r)if(-1!==n.indexOf(".")||-1!==n.indexOf("["))$(r,n);else if("object"===m(r[n])&&r[n]){var i=r[n];for(var o in i)-1===o.indexOf(".")&&-1===o.indexOf("[")||$(i,o)}}return t}var tt,et=/([.[])/g,rt=/\]/g,nt=Object.freeze({FRAME_MS:D,TOO_LONG_FRAME_MS:250,CHAINED_TWEENS:U,EVENT_CALLBACK:A,EVENT_UPDATE:V,EVENT_COMPLETE:B,EVENT_START:G,EVENT_REPEAT:z,EVENT_REVERSE:Q,EVENT_PAUSE:"pause",EVENT_PLAY:"play",EVENT_RESTART:E,EVENT_STOP:"stop",EVENT_SEEK:"seek",STRING_PROP:M,NUM_REGEX:P,deepCopy:R,decomposeString:W,decompose:H,RGB:"rgb(",RGBA:X,isRGBColor:Y,recompose:Z,SET_NESTED:J}),it={Linear:function(t,e,r){var n=t.length-1,i=n*e,o=Math.floor(i),s=it.Utils.Linear;return e<0?s(t[0],t[1],i,r):1<e?s(t[n],t[n-1],n-i,r):s(t[o],t[n<o+1?n:o+1],i-o,r)},Bezier:function(t,e,r){for(var n=it.Utils.Reset(r),i=t.length-1,o=Math.pow,s=it.Utils.Bernstein,a=Array.isArray(n),u=0;u<=i;u++)if("number"==typeof n)n+=o(1-e,i-u)*o(e,u)*t[u]*s(i,u);else if(a)for(var f=0,l=n.length;f<l;f++)"number"==typeof n[f]?n[f]+=o(1-e,i-u)*o(e,u)*t[u][f]*s(i,u):n[f]=t[u][f];else if("object"===m(n))for(var h in n)"number"==typeof n[h]?n[h]+=o(1-e,i-u)*o(e,u)*t[u][h]*s(i,u):n[h]=t[u][h];else if("string"==typeof n){for(var c="",p=t[Math.round(i*e)],y=1,d=p.length;y<d;y++)c+=p[y];return c}return n},CatmullRom:function(t,e,r){var n=t.length-1,i=n*e,o=Math.floor(i),s=it.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(o=Math.floor(i=n*(1+e))),s(t[(o-1+n)%n],t[o],t[(o+1)%n],t[(o+2)%n],i-o,r)):e<0?s(t[1],t[1],t[0],t[0],-e,r):1<e?s(t[n-1],t[n-1],t[n],t[n],(0|e)-e,r):s(t[o?o-1:0],t[o],t[n<o+1?n:o+1],t[n<o+2?n:o+2],i-o,r)},Utils:{Linear:function(t,e,r,n){if(t===e||"string"==typeof t){if(e.length&&e.splice&&e.isString){e="";for(var i=0,o=t.length;i<o;i++)e+=t[i]}return e}if("number"==typeof t)return"function"==typeof t?t(r):t+(e-t)*r;if("object"===m(t)){if(void 0!==t.length){var s="string"==typeof t[0]||t.isString;if(s||t[0]===M){for(var a="",u=s?0:1,f=t.length;u<f;u++){var l=0===r?t[u]:1===r?e[u]:"number"==typeof t[u]?t[u]+(e[u]-t[u])*r:e[u];(0<r&&r<1&&Y(t,u)||Y(t,u,X))&&(l|=0),a+=l}return a}if(n&&n.length&&n.splice)for(var h=0,c=n.length;h<c;h++)n[h]=it.Utils.Linear(t[h],e[h],r,n[h])}else for(var p in n)n[p]=it.Utils.Linear(t[p],e[p],r,n[p]);return n}},Reset:function(t){if(Array.isArray(t)){for(var e=0,r=t.length;e<r;e++)t[e]=it.Utils.Reset(t[e]);return t}if("object"!==m(t))return"number"==typeof t?0:t;for(var n in t)t[n]=it.Utils.Reset(t[n]);return t},Bernstein:function(t,e){var r=it.Utils.Factorial;return r(t)/r(e)/r(t-e)},Factorial:(tt=[1],function(t){var e=1;if(tt[t])return tt[t];for(var r=t;1<r;r--)e*=r;return tt[t]=e}),CatmullRom:function(t,e,r,n,i,o){if("string"==typeof t)return e;if("number"==typeof t){var s=.5*(r-t),a=.5*(n-e),u=i*i;return(2*e-2*r+s+a)*(i*u)+(-3*e+3*r-2*s-a)*u+s*i+e}if("object"===m(t)){if(void 0!==t.length){if(t[0]===M){for(var f="",l=1,h=t.length;l<h;l++){var c="number"==typeof t[l]?it.Utils.CatmullRom(t[l],e[l],r[l],n[l],i):n[l];(Y(t,l)||Y(t,l,X))&&(c|=0),f+=c}return f}for(var p=0,y=o.length;p<y;p++)o[p]=it.Utils.CatmullRom(t[p],e[p],r[p],n[p],i,o[p])}else for(var d in o)o[d]=it.Utils.CatmullRom(t[d],e[d],r[d],n[d],i,o[d]);return o}}}},ot={};function st(t,e,r){if(!t||!t.nodeType)return e;var n=t.queueID||"q_"+Date.now();t.queueID||(t.queueID=n);var i=ot[n];if(i){if(i.object===e&&t===i.tween.node&&r._startTime===i.tween._startTime)N(i.tween);else if("object"===m(e)&&e&&i.object){for(var o in e)o in i.object&&(r._startTime===i.tween._startTime?delete i.object[o]:i.propNormaliseRequired=!0);Object.assign(i.object,e)}return i.object}return"object"===m(e)&&e?(ot[n]={tween:r,object:e,propNormaliseRequired:!1},ot[n].object):e}function at(t,e,r){return e?t?"undefined"!=typeof window&&t===window||"undefined"!=typeof document&&t===document?[t]:"string"==typeof t?!!document.querySelectorAll&&document.querySelectorAll(t):Array.isArray(t)?t:t.nodeType?[t]:r?t:[]:null:t?"undefined"!=typeof window&&t===window||"undefined"!=typeof document&&t===document?t:"string"==typeof t?!!document.querySelector&&document.querySelector(t):Array.isArray(t)?t[0]:t.nodeType?t:r?t:null:null}var ut=0,ft=v.Linear.None,lt=function(){function L(t,e){return _(this,L),this.id=ut++,!t||"object"!==m(t)||e||t.nodeType?t&&(t.nodeType||t.length||"string"==typeof t)&&(t=this.node=at(t),e=this.object=st(t,e,this)):(e=this.object=t,t=null),this._valuesEnd=null,this._valuesStart=Array.isArray(e)?[]:{},this._duration=1e3,this._easingFunction=ft,this._easingReverse=ft,this._interpolationFunction=it.Linear,this._startTime=0,this._initTime=0,this._delayTime=0,this._repeat=0,this._r=0,this._isPlaying=!1,this._yoyo=!1,this._reversed=!1,this._onStartCallbackFired=!1,this._pausedTime=null,this._isFinite=!0,this._maxListener=15,this._chainedTweensCount=0,this._prevTime=null,this}return b(L,null,[{key:"fromTo",value:function(t,e,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};n.quickRender=n.quickRender?n.quickRender:!r;var i=new L(t,e).to(r,n);return n.quickRender&&(i.render().update(i._startTime),i._rendered=!1,i._onStartCallbackFired=!1),i}},{key:"to",value:function(t,e,r){return L.fromTo(t,null,e,r)}},{key:"from",value:function(t,e,r){return L.fromTo(t,e,null,r)}}]),b(L,[{key:"setMaxListener",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:15;return this._maxListener=t,this}},{key:"on",value:function(t,e){for(var r=this._maxListener,n=t+A,i=0;i<r;i++){var o=n+i;if(!this[o]){this[o]=e;break}}return this}},{key:"once",value:function(t,i){for(var o=this,e=this._maxListener,r=t+A,n=function(t){var n=r+t;if(!o[n])return o[n]=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];i.apply(o,e),o[n]=null},"break"},s=0;s<e;s++){if("break"===n(s))break}return this}},{key:"off",value:function(t,e){for(var r=this._maxListener,n=t+A,i=0;i<r;i++){var o=n+i;this[o]===e&&(this[o]=null)}return this}},{key:"emit",value:function(t,e,r,n){var i=this._maxListener,o=t+A;if(!this[o+0])return this;for(var s=0;s<i;s++){var a=o+s;this[a]&&this[a](e,r,n)}return this}},{key:"isPlaying",value:function(){return this._isPlaying}},{key:"isStarted",value:function(){return this._onStartCallbackFired}},{key:"reverse",value:function(t){var e=this._reversed;return this._reversed=void 0!==t?t:!e,this}},{key:"reversed",value:function(){return this._reversed}},{key:"pause",value:function(){return this._isPlaying?(this._isPlaying=!1,N(this),this._pausedTime=C(),this.emit("pause",this.object)):this}},{key:"play",value:function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=C()-this._pausedTime,this._initTime=this._startTime,s(this),this._pausedTime=C(),this.emit("play",this.object))}},{key:"restart",value:function(t){return this._repeat=this._r,this.reassignValues(),s(this),this.emit(E,this.object)}},{key:"seek",value:function(t,e){var r=this._duration,n=this._initTime,i=this._startTime,o=this._reversed,s=n+t;return this._isPlaying=!0,s<i&&n<=i&&(this._startTime-=r,this._reversed=!o),this.update(t,!1),this.emit("seek",t,this.object),e?this:this.pause()}},{key:"duration",value:function(t){return this._duration="function"==typeof t?t(this._duration):t,this}},{key:"to",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e3;if(this._valuesEnd=t,"number"==typeof e||"function"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"===m(e))for(var r in e)if("function"==typeof this[r]){var n=j(Array.isArray(e[r])?e[r]:[e[r]],4),i=n[0],o=void 0===i?null:i,s=n[1],a=void 0===s?null:s,u=n[2],f=void 0===u?null:u,l=n[3],h=void 0===l?null:l;this[r](o,a,f,h)}return this}},{key:"render",value:function(){if(this._rendered)return this;var t=this._valuesStart,e=this._valuesEnd,r=this.object,n=this.node,i=this.InitialValues;if(J(r),J(e),n&&n.queueID&&ot[n.queueID]){var o=ot[n.queueID];if(o.propNormaliseRequired&&o.tween!==this){for(var s in e)o.tween._valuesEnd[s];o.normalisedProp=!0,o.propNormaliseRequired=!1}}for(var a in n&&i&&(r&&0!==Object.keys(r).length?e&&0!==Object.keys(e).length||(e=this._valuesEnd=i(n,r)):r=this.object=st(n,i(n,e),this)),e){var u=r&&r[a]&&R(r[a]),f=e[a];if(!(q[a]&&q[a].init&&(q[a].init.call(this,u,f,a,r),void 0===u&&t[a]&&(u=t[a]),q[a].skipProcess))&&!("number"==typeof u&&isNaN(u)||null===u||null===f||!1===u||!1===f||void 0===u||void 0===f||u===f)){if(Array.isArray(f))if(Array.isArray(u))f.isString&&r[a].isString&&!u.isString&&(u.isString=!0);else{f.unshift(u);for(var l=0,h=f.length;l<h;l++)"string"==typeof f[l]&&(f[l]=W(f[l]))}"number"==typeof(t[a]=u)&&"string"==typeof f&&"="===f[1]||H(a,r,t,e)}}return L.Renderer&&this.node&&L.Renderer.init&&(L.Renderer.init.call(this,r,t,e),this.__render=!0),this}},{key:"start",value:function(t){return this._startTime=void 0!==t?"string"==typeof t?C()+parseFloat(t):t:C(),this._startTime+=this._delayTime,this._initTime=this._prevTime=this._startTime,this._onStartCallbackFired=!1,this._rendered=!1,this._isPlaying=!0,s(this),this}},{key:"stop",value:function(){var t=this._isPlaying,e=this._isFinite,r=this.object,n=this._startTime,i=this._duration,o=this._r,s=this._yoyo,a=this._reversed;if(!t)return this;var u=e?(o+1)%2==1:!a;return this._reversed=!1,s&&u?this.update(n):this.update(n+i),N(this),this.emit("stop",r)}},{key:"delay",value:function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this}},{key:"chainedTweens",value:function(){if(this._chainedTweensCount=arguments.length,!this._chainedTweensCount)return this;for(var t=0,e=this._chainedTweensCount;t<e;t++)this[U+t]=arguments[t];return this}},{key:"repeat",value:function(t){return this._repeat=this._duration?"function"==typeof t?t(this._repeat):t:0,this._r=this._repeat,this._isFinite=isFinite(t),this}},{key:"reverseDelay",value:function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this}},{key:"yoyo",value:function(t,e){return this._yoyo="function"==typeof t?t(this._yoyo):null===t?this._yoyo:t,t||(this._reversed=!1),this._easingReverse=e||null,this}},{key:"easing",value:function(t){return this._easingFunction=t,this}},{key:"interpolation",value:function(t){return"function"==typeof t&&(this._interpolationFunction=t),this}},{key:"reassignValues",value:function(t){var e=this._valuesStart,r=this.object,n=this._delayTime;for(var i in this._isPlaying=!0,this._startTime=void 0!==t?t:C(),this._startTime+=n,this._reversed=!1,s(this),e){var o=e[i];r[i]=o}return this}},{key:"update",value:function(t,e,r){var n,i,o,s=this._onStartCallbackFired,a=this._easingFunction,u=this._interpolationFunction,f=this._easingReverse,l=this._repeat,h=this._delayTime,c=this._reverseDelayTime,p=this._yoyo,y=this._reversed,d=this._startTime,v=this._prevTime,_=this._duration,m=this._valuesStart,g=this._valuesEnd,b=this.object,T=this._isFinite,k=this._isPlaying,w=this.__render,O=this._chainedTweensCount,S=0;if(_){var j=(t=void 0!==t?t:C())-v;if(this._prevTime=t,250<j&&F()&&x()&&(t-=j-D),!k||t<d&&!r)return!0;n=1<(n=(t-d)/_)?1:n,n=y?1-n:n}else n=1,l=0;if(s||(this._rendered||(this.render(),this._rendered=!0),this.emit(G,b),this._onStartCallbackFired=!0),i=y&&f||a,!b)return!0;for(o in g){var A=m[o];if(null!=A||q[o]&&q[o].update){var E=g[o],M=i[o]?i[o](n):"function"==typeof i?i(n):ft(n),P=u[o]?u[o]:"function"==typeof u?u:it.Linear;"number"==typeof E?b[o]=A+(E-A)*M:!Array.isArray(E)||E.isString||Array.isArray(A)&&!A.isString?E&&E.update?E.update(M):"function"==typeof E?b[o]=E(M):"string"==typeof E&&"number"==typeof A?b[o]=A+parseFloat(E[0]+E.substr(2))*M:A&&E&&A.splice&&E.splice&&A.isString&&E.isString?b[o]=Z(o,b,m,g,M,n):Z(o,b,m,g,M,n):b[o]=P(E,M,b[o]),q[o]&&q[o].update&&q[o].update.call(this,b[o],A,E,M,n,o),S++}}if(!S)return N(this),!1;if(w&&L.Renderer&&L.Renderer.update&&L.Renderer.update.call(this,b,n),this.emit(V,b,n,t),1===n||y&&0===n){if(0<l&&0<_){if(T&&this._repeat--,p)this._reversed=!y;else for(o in g){var R=g[o];"string"==typeof R&&"number"==typeof m[o]&&(m[o]+=parseFloat(R[0]+R.substr(2)))}return this.emit(p&&!y?Q:z,b),this._startTime=y&&c?t-c:t+h,!0}if(e||(this._isPlaying=!1,N(this),ut--),this.emit(B,b),this._repeat=this._r,O)for(var I=0;I<O;I++)this[U+I].start(t+_);return!1}return!0}}]),L}(),ht=function(){function t(){_(this,t),this.totalTime=0,this.labels=[],this.offsets=[]}return b(t,[{key:"parseLabel",value:function(t,e){var r=this.offsets,n=this.labels,i=n.indexOf(t);if("string"==typeof t&&-1!==t.indexOf("=")&&!e&&-1===i){var o=t.substr(t.indexOf("=")-1,2),s=t.split(o);e=2===s.length?o+s[1]:null,t=s[0],i=n.indexOf(t)}if(-1!==i&&t){var a=r[i]||0;if("number"==typeof e)a=e;else if("string"==typeof e&&-1!==e.indexOf("=")){var u=e.charAt(0);e=Number(e.substr(2)),"+"===u||"-"===u?a+=parseFloat(u+e):"*"===u?a*=e:"/"===u?a/=e:"%"===u&&(a*=e/100)}return a}return"number"==typeof e?e:0}},{key:"addLabel",value:function(t,e){return this.labels.push(t),this.offsets.push(this.parseLabel(t,e)),this}},{key:"setLabel",value:function(t,e){var r=this.labels.indexOf(t);return-1!==r&&this.offsets.splice(r,1,this.parseLabel(t,e)),this}},{key:"eraseLabel",value:function(t){var e=this.labels.indexOf(t);return-1!==e&&(this.labels.splice(e,1),this.offsets.splice(e,1)),this}}]),t}(),ct=0,pt=function(t){function r(t){var e;return _(this,r),(e=S(this,k(r).call(this)))._duration=0,e._startTime=t&&void 0!==t.startTime?t.startTime:C(),e._tweens=[],e.elapsed=0,e._id=ct++,e._defaultParams=t,e.position=new ht,e.position.addLabel("afterLast",e._duration),e.position.addLabel("afterInit",e._startTime),e._onStartCallbackFired=!1,S(e,O(e))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&w(t,e)}(r,lt),b(r,[{key:"mapTotal",value:function(t){return t.call(this,this._tweens),this}},{key:"timingOrder",value:function(t){var r=t(this._tweens.map(function(t){return t._startTime}));return this._tweens.map(function(t,e){t._startTime=r[e]}),this}},{key:"getTiming",value:function(t,e,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;if("reverse"===t){var i=r.stagger,o=(i||0)*(e.length-1);return e.map(function(t,e){return o-(i||0)*e+n})}if("async"===t)return e.map(function(t){return n});if("sequence"===t||"delayed"===t){var s=r.stagger;return s||(s=(r.duration||1e3)/(e.length-1)),e.map(function(t,e){return s*e+n})}if("oneByOne"===t)return e.map(function(t){return r.duration});if("shuffle"===t){var a=r.stagger;return function(t){var e,r,n;for(n=t.length;n;n-=1)e=Math.floor(Math.random()*n),r=t[n-1],t[n-1]=t[e],t[e]=r;return t}(e.map(function(t,e){return(a||0)*e+n}))}var u=r.stagger;return e.map(function(t,e){return(u||0)*e+n})}},{key:"fromTo",value:function(t,e,r,n){if((t=at(t,!0,!0))&&t.length){this._defaultParams&&(n=n?T({},this._defaultParams,n):this._defaultParams);for(var i,o=n.label,s="number"==typeof o?o:this.position.parseLabel(void 0!==o?o:"afterLast",null),a=this.getTiming(n.mode,t,n,s),u=0,f=t.length;u<f;u++)i=t[u],this.add(lt.fromTo(i,"function"==typeof e?e(u,t.length):"object"===m(e)&&e?T({},e):null,"function"==typeof r?r(u,t.length):r,"function"==typeof n?n(u,t.length):n),a[u])}return this.start()}},{key:"from",value:function(t,e,r){return this.fromTo(t,e,null,r)}},{key:"to",value:function(t,e,r){return this.fromTo(t,null,e,r)}},{key:"addLabel",value:function(t,e){return this.position.addLabel(t,e),this}},{key:"map",value:function(t){for(var e=0,r=this._tweens.length;e<r;e++){var n=this._tweens[e];t(n,e),this._duration=Math.max(this._duration,n._duration+n._startTime)}return this}},{key:"add",value:function(t,e){var r=this;if(Array.isArray(t))return t.map(function(t){r.add(t,e)}),this;"object"!==m(t)||t instanceof lt||(t=new lt(t.from).to(t.to,t));var n=this._defaultParams,i=this._duration;if(n)for(var o in n)"function"==typeof t[o]&&t[o](n[o]);var s="number"==typeof e?e:this.position.parseLabel(void 0!==e?e:"afterLast",null);return t._startTime=Math.max(this._startTime,t._delayTime,s),t._delayTime=s,t._isPlaying=!0,this._duration=Math.max(i,Math.max(t._startTime+t._delayTime,t._duration)),this._tweens.push(t),this.position.setLabel("afterLast",this._duration),this}},{key:"restart",value:function(){return this._startTime+=C(),s(this),this.emit(E)}},{key:"easing",value:function(e){return this.map(function(t){return t.easing(e)})}},{key:"interpolation",value:function(e){return this.map(function(t){return t.interpolation(e)})}},{key:"update",value:function(t){var e,r=this._tweens,n=this._duration,i=this._reverseDelayTime,o=this._startTime,s=this._reversed,a=this._yoyo,u=this._repeat,f=this._isFinite,l=this._isPlaying,h=this._prevTime,c=this._onStartCallbackFired,p=(t=void 0!==t?t:C())-h;if(this._prevTime=t,250<p&&F()&&x()&&(t-=p-D),!l||t<o)return!0;e=1<(e=(t-o)/n)?1:e,e=s?1-e:e,this.elapsed=e,c||(this.emit(G),this._onStartCallbackFired=!0);for(var y=t-o,d=s?n-y:y,v=0;v<r.length;)r[v].update(d),v++;if(this.emit(V,e,y),1===e||s&&0===e){if(u){for(f&&this._repeat--,this.emit(s?Q:z),a&&(this._reversed=!s,this.timingOrder(function(t){return t.reverse()})),this._startTime=s&&i?t+i:t,v=0;v<r.length;)r[v].reassignValues(t),v++;return!0}return this.emit(B),this._repeat=this._r,N(this),this._isPlaying=!1}return!0}},{key:"progress",value:function(t){return void 0!==t?this.update(t*this._duration):this.elapsed}}]),r}();t.Easing=v,t.FrameThrottle=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:120;y=1.05*t},t.Interpolation=it,t.Interpolator=function(i,o){var s=Array.isArray(i)&&!i.isString,a="string"==typeof i?i:s?i.slice():T({},i);if(s)for(var t=0,e=i.length;t<e;t++)i[t]===o[t]&&"number"==typeof i[t]&&"number"!=typeof o[t]||H(t,a,i,o);else if("object"===m(i))for(var r in i)i[r]===o[r]&&"number"==typeof i[r]&&"number"!=typeof o[r]||H(r,a,i,o);else if("string"==typeof i){i=W(i),o=W(o);for(var n=1;n<i.length;)i[n]===o[n]&&"string"==typeof i[n-1]?(i.splice(n-1,2,i[n-1]+i[n]),o.splice(n-1,2,o[n-1]+o[n])):n++}return function(t){if(s)for(var e=0,r=i.length;e<r;e++)Z(e,a,i,o,t);else if("object"===m(a))for(var n in i)Z(n,a,i,o,t);else"string"==typeof a&&(a=Z(0,0,i,o,t,t,!0));return a}},t.Plugins=q,t.Selector=at,t.Timeline=pt,t.ToggleLagSmoothing=function(){var t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];d=t},t.Tween=lt,t.add=s,t.autoPlay=function(t){l=t},t.get=e,t.getAll=function(){return u},t.has=function(t){return null!==e(t)},t.isRunning=F,t.now=C,t.onRequestTick=function(t){h.push(t)},t.onTick=function(t){return u.push({update:t})},t.remove=N,t.removeAll=function(){u.length=0,a(o),f=!1},t.update=i,t.utils=nt,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "es6-tween", | ||
"version": "5.5.5", | ||
"version": "5.5.6", | ||
"description": "ES6 implementation of amazing tween.js", | ||
@@ -5,0 +5,0 @@ "browser": "bundled/Tween.min.js", |
@@ -62,8 +62,14 @@ // Frame lag-fix constants | ||
export function decomposeString (fromValue) { | ||
return typeof fromValue !== 'string' | ||
? fromValue | ||
: fromValue | ||
.replace(hexColor, hex2rgb) | ||
.match(NUM_REGEX) | ||
.map((v) => (isNaNForST(v) ? v : +v)) | ||
if (fromValue && fromValue.splice && fromValue.isString) { | ||
return fromValue | ||
} | ||
const value = | ||
typeof fromValue !== 'string' | ||
? fromValue | ||
: fromValue | ||
.replace(hexColor, hex2rgb) | ||
.match(NUM_REGEX) | ||
.map((v) => (isNaNForST(v) ? v : +v)) | ||
value.isString = true | ||
return value | ||
} | ||
@@ -76,7 +82,9 @@ | ||
if (typeof fromValue === 'string' && Array.isArray(toValue)) { | ||
if (typeof fromValue === 'number' && typeof toValue === 'number') { | ||
// | ||
} else if (fromValue && fromValue.splice && fromValue.isString && toValue && toValue.splice && toValue.isString) { | ||
} else if (typeof fromValue === 'string' && Array.isArray(toValue)) { | ||
const fromValue1 = decomposeString(fromValue) | ||
const toValues = toValue.map(decomposeString) | ||
fromValue1.isString = true | ||
from[prop] = fromValue1 | ||
@@ -108,5 +116,2 @@ to[prop] = toValues | ||
fromValue1.isString = true | ||
toValue1.isString = true | ||
from[prop] = fromValue1 | ||
@@ -116,3 +121,3 @@ to[prop] = toValue1 | ||
} else if (typeof fromValue === 'object' && typeof toValue === 'object') { | ||
if (Array.isArray(fromValue)) { | ||
if (Array.isArray(fromValue) && !fromValue.isString) { | ||
return fromValue.map((v, i) => decompose(i, obj[prop], fromValue, toValue)) | ||
@@ -147,19 +152,30 @@ } else { | ||
} | ||
if (typeof fromValue === 'object' && !!fromValue && fromValue.isString) { | ||
if ( | ||
typeof fromValue === 'object' && | ||
!!fromValue && | ||
fromValue.isString && | ||
toValue && | ||
toValue.splice && | ||
toValue.isString | ||
) { | ||
let STRING_BUFFER = '' | ||
for (let i = 0, len = fromValue.length; i < len; i++) { | ||
const isRelative = typeof fromValue[i] === 'number' && typeof toValue[i] === 'string' && toValue[i][1] === '=' | ||
let currentValue = | ||
typeof fromValue[i] !== 'number' | ||
? fromValue[i] | ||
: isRelative | ||
? fromValue[i] + parseFloat(toValue[i][0] + toValue[i].substr(2)) * t | ||
: fromValue[i] + (toValue[i] - fromValue[i]) * t | ||
if (isRGBColor(fromValue, i) || isRGBColor(fromValue, i, RGBA)) { | ||
currentValue |= 0 | ||
if (fromValue[i] !== toValue[i] || typeof fromValue[i] !== 'number' || typeof toValue[i] === 'number') { | ||
const isRelative = typeof fromValue[i] === 'number' && typeof toValue[i] === 'string' && toValue[i][1] === '=' | ||
let currentValue = | ||
typeof fromValue[i] !== 'number' | ||
? fromValue[i] | ||
: isRelative | ||
? fromValue[i] + parseFloat(toValue[i][0] + toValue[i].substr(2)) * t | ||
: fromValue[i] + (toValue[i] - fromValue[i]) * t | ||
if (isRGBColor(fromValue, i) || isRGBColor(fromValue, i, RGBA)) { | ||
currentValue |= 0 | ||
} | ||
STRING_BUFFER += currentValue | ||
if (isRelative && originalT === 1) { | ||
fromValue[i] = fromValue[i] + parseFloat(toValue[i][0] + toValue[i].substr(2)) | ||
} | ||
} else { | ||
STRING_BUFFER += fromValue[i] | ||
} | ||
STRING_BUFFER += currentValue | ||
if (isRelative && originalT === 1) { | ||
fromValue[i] = fromValue[i] + parseFloat(toValue[i][0] + toValue[i].substr(2)) | ||
} | ||
} | ||
@@ -166,0 +182,0 @@ if (!stringBuffer) { |
@@ -16,7 +16,11 @@ import { decompose, recompose, decomposeString } from './constants' | ||
for (let i = 0, len = a.length; i < len; i++) { | ||
decompose(i, origin, a, b) | ||
if (a[i] !== b[i] || typeof a[i] !== 'number' || typeof b[i] === 'number') { | ||
decompose(i, origin, a, b) | ||
} | ||
} | ||
} else if (typeof a === 'object') { | ||
for (let i in a) { | ||
decompose(i, origin, a, b) | ||
if (a[i] !== b[i] || typeof a[i] !== 'number' || typeof b[i] === 'number') { | ||
decompose(i, origin, a, b) | ||
} | ||
} | ||
@@ -36,5 +40,2 @@ } else if (typeof a === 'string') { | ||
} | ||
a.isString = true | ||
b.isString = true | ||
} | ||
@@ -41,0 +42,0 @@ return (t) => { |
@@ -429,10 +429,14 @@ import { add, now, Plugins, remove, isRunning, isLagSmoothing } from './core' | ||
} | ||
if (Array.isArray(end) && !Array.isArray(start)) { | ||
end.unshift(start) | ||
for (let i = 0, len = end.length; i < len; i++) { | ||
if (typeof end[i] === 'string') { | ||
let arrayOfStrings = decomposeString(end[i]) | ||
arrayOfStrings.isString = true | ||
end[i] = arrayOfStrings | ||
if (Array.isArray(end)) { | ||
if (!Array.isArray(start)) { | ||
end.unshift(start) | ||
for (let i = 0, len = end.length; i < len; i++) { | ||
if (typeof end[i] === 'string') { | ||
end[i] = decomposeString(end[i]) | ||
} | ||
} | ||
} else { | ||
if (end.isString && object[property].isString && !start.isString) { | ||
start.isString = true | ||
} | ||
} | ||
@@ -724,2 +728,4 @@ } | ||
object[property] = start + parseFloat(end[0] + end.substr(2)) * value | ||
} else if (start && end && start.splice && end.splice && start.isString && end.isString) { | ||
object[property] = recompose(property, object, _valuesStart, _valuesEnd, value, elapsed) | ||
} else { | ||
@@ -726,0 +732,0 @@ recompose(property, object, _valuesStart, _valuesEnd, value, elapsed) |
27
test.js
@@ -51,4 +51,19 @@ /* global TWEEN */ | ||
test('Value Interpolation', (t) => { | ||
let obj = { a: 0, b: 'B value 1', c: { x: 2 }, d: [3], _e: 4, g: 5, h: 0, j: 0, k: '#000' } | ||
const m = ['rgb(', 0, ', 204, ', 255, ')'] | ||
m.isString = true | ||
let obj = { | ||
a: 0, | ||
b: 'B value 1', | ||
c: { x: 2 }, | ||
d: [3], | ||
_e: 4, | ||
g: 5, | ||
h: 0, | ||
j: 0, | ||
k: '#000', | ||
l: '#0cf', | ||
m | ||
} | ||
Object.defineProperty(obj, 'e', { | ||
@@ -63,2 +78,4 @@ get () { | ||
const m2 = ['rgb(', 255, ', 204, ', 0, ')'] | ||
m2.isString = true | ||
new Tween(obj) | ||
@@ -75,3 +92,5 @@ .to( | ||
j: [1, 2], | ||
k: ['rgb(100, 100, 100)', 'rgb(200, 200, 200)'] | ||
k: ['rgb(100, 100, 100)', 'rgb(200, 200, 200)'], | ||
l: '#fc0', | ||
m: 'rgb(255, 204, 0)' | ||
}, | ||
@@ -93,2 +112,4 @@ 100 | ||
t.is(obj.k, 'rgb(0, 0, 0)') | ||
t.is(obj.l, 'rgb(0, 204, 255)') | ||
t.is(obj.m, 'rgb(0, 204, 255)') | ||
@@ -135,2 +156,4 @@ update(50) | ||
t.is(obj.k, 'rgb(200, 200, 200)', 'Multi-Interpolation not worked as excepted') | ||
t.is(obj.l, 'rgb(255, 204, 0)', 'String interpolation not worked as excepted') | ||
t.is(obj.m, 'rgb(255, 204, 0)', 'Array as string interpolation not worked as excepted') | ||
}) | ||
@@ -137,0 +160,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
374368
4943