es6-tween
Advanced tools
Comparing version 5.5.2 to 5.5.3
@@ -9,4 +9,4 @@ { | ||
"globals": { | ||
"Atomics": "readable", | ||
"SharedArrayBuffer": "readable" | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
@@ -17,4 +17,3 @@ "parserOptions": { | ||
}, | ||
"rules": { | ||
} | ||
} | ||
"rules": {} | ||
} |
@@ -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";var o,e="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this||(void 0!==t?t:{}),r=e.requestAnimationFrame||function(t){return e.setTimeout(t,50/3)},s=e.cancelAnimationFrame||function(t){return e.clearTimeout(t)},F=function(){if("undefined"==typeof process||void 0===process.hrtime||process.versions&&void 0!==process.versions.electron){if(void 0!==e.performance&&void 0!==e.performance.now)return e.performance.now.bind(e.performance);var t=e.performance&&e.performance.timing&&e.performance.timing.navigationStart?e.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}return function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}}(),a=[],u=!1,f=!1,l=[],h=r,c=0,p=120,d=!0,v=function(t){var e=a.indexOf(t);-1<e&&a.splice(e,1),a.push(t),c=0,f&&!u&&(o=h(i),u=!0)},n=function(t){for(var e=0;e<a.length;e++)if(t===a[e])return a[e];return null},x=function(t){var e=a.indexOf(t);-1!==e&&a.splice(e,1),0===a.length&&(s(o),u=!1)},i=function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:F(),r=1<arguments.length?arguments[1]:void 0;if(p<=c&&d)return u=!1,c=0,s(o),!1;f&&u?o=h(t):function(){for(var t=0;t<l.length;t++)l[t]()}(),a.length||c++;for(var n=0,i=a.length;n<i;)a[n++].update(e,r),i>a.length&&n--,i=a.length;return!0},C=function(){return u},N=function(){return d},q={},y={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){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*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-y.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*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 E(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",S="restart",P="STRING_PROP",R=/\s+|([A-Za-z?().,{}:""[\]#%]+)|([-+]=+)?([-+]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]=?\d+)?/g;function M(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]=M(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})$/i,X=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 H(t){return"string"!=typeof t?t:t.replace(L,X).match(R).map(function(t){return I(t)?t:+t})}function K(r,n,t,e,i){var o=t[r],s=e[r];if("string"==typeof o||"string"==typeof s){for(var a=Array.isArray(o)&&o[0]===P?o:H(o),u=Array.isArray(s)&&s[0]===P?s:H(s),f=1;f<a.length;)a[f]===u[f]&&"string"==typeof a[f-1]?(a.splice(f-1,2,a[f-1]+a[f]),u.splice(f-1,2,u[f-1]+u[f])):f++;a[f=0]===P&&a.shift(),u[0]===P&&u.shift();for(var l={isString:!0,length:a.length},h={isString:!0,length:u.length};f<l.length;)l[f]=a[f],h[f]=u[f],f++;return t[r]=l,e[r]=h,!0}if("object"!==m(o)||"object"!==m(s))return!1;if(Array.isArray(o))return o.map(function(t,e){return K(e,n[r],o,s)});for(var c in s)K(c,n[r],o,s);return!0}var W="rgba(",$=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 Y(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;($(a,l)||$(a,l,W))&&(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]!==P)for(var d=0,v=a.length;d<v;d++)a[d]!==u[d]&&Y(d,e[t],a,u,i,o);else if("object"===m(a)&&a&&!a.isString)for(var y in a)a[y]!==u[y]&&Y(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]}var Z,J=/([.[])/g,tt=/\]/g,et=function(t,e){var i=t[e],o=e.replace(tt,"").split(J),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)},rt=function(t){if("object"===m(t)&&t)for(var e in t)if(-1!==e.indexOf(".")||-1!==e.indexOf("["))et(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("["))et(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("[")||et(i,o)}}return t},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:S,EVENT_STOP:"stop",EVENT_SEEK:"seek",STRING_PROP:P,NUM_REGEX:R,HEXC_REGEX:/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,deepCopy:M,decomposeString:H,decompose:K,RGB:"rgb(",RGBA:W,isRGBColor:$,recompose:Y,SET_NESTED:rt}),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("string"==typeof t)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){if(t[0]===P){for(var i="",o=1,s=t.length;o<s;o++){var a="number"==typeof t[o]?t[o]+(e[o]-t[o])*r:e[o];($(t,o)||$(t,o,W))&&(a|=0),i+=a}return i}for(var u=0,f=n.length;u<f;u++)n[u]=it.Utils.Linear(t[u],e[u],r,n[u])}else for(var l in n)n[l]=it.Utils.Linear(t[l],e[l],r,n[l]);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:(Z=[1],function(t){var e=1;if(Z[t])return Z[t];for(var r=t;1<r;r--)e*=r;return Z[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]===P){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];($(t,l)||$(t,l,W))&&(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)x(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);i.object=T({},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+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,i){var o=this._maxListener,s=t+A;if(!this[s+0])return this;for(var a=0;a<o;a++){var u=s+a;this[u]&&this[u](e,r,n,i)}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,x(this),this._pausedTime=F(),this.emit("pause",this.object)):this}},{key:"play",value:function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=F()-this._pausedTime,this._initTime=this._startTime,v(this),this._pausedTime=F(),this.emit("play",this.object))}},{key:"restart",value:function(t){return this._repeat=this._r,this.reassignValues(),v(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=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(rt(r),rt(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]&&M(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]){for(var c=H(f[l]),p={length:c.length,isString:!0},d=0,v=c.length;d<v;d++)p[d]=c[d];f[l]=p}}"number"==typeof(t[a]=u)&&"string"==typeof f&&"="===f[1]||K(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?F()+parseFloat(t):t:F(),this._startTime+=this._delayTime,this._initTime=this._prevTime=this._startTime,this._onStartCallbackFired=!1,this._rendered=!1,this._isPlaying=!0,v(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),x(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:F(),this._startTime+=n,this._reversed=!1,v(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,E=0;if(_){var j=(t=void 0!==t?t:F())-y;if(this._prevTime=t,250<j&&C()&&N()&&(t-=j-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 A=m[o];if(null!=A||q[o]&&q[o].update){var S=g[o],P=i[o]?i[o](n):"function"==typeof i?i(n):ft(n),R=u[o]?u[o]:"function"==typeof u?u:it.Linear;"number"==typeof S?b[o]=A+(S-A)*P:Array.isArray(S)&&!Array.isArray(A)?b[o]=R(S,P,b[o]):S&&S.update?S.update(P):"function"==typeof S?b[o]=S(P):"string"==typeof S&&"number"==typeof A?b[o]=A+parseFloat(S[0]+S.substr(2))*P:Y(o,b,m,g,P,n),q[o]&&q[o].update&&q[o].update.call(this,b[o],A,S,P,n,o),E++}}if(!E)return x(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 M=g[o];"string"==typeof M&&"number"==typeof m[o]&&(m[o]+=parseFloat(M[0]+M.substr(2)))}return this.emit(p&&!d?Q:z,b),this._startTime=d&&c?t-c:t+h,!0}if(e||(this._isPlaying=!1,x(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=E(this,k(r).call(this)))._duration=0,e._startTime=void 0!==t.startTime?t.startTime:F(),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,E(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+=F(),v(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:F())-h;if(this._prevTime=t,250<p&&C()&&N()&&(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,x(this),this._isPlaying=!1}return!0}},{key:"progress",value:function(t){return void 0!==t?this.update(t*this._duration):this.elapsed}}]),r}();t.Plugins=q,t.Selector=at,t.Interpolator=function(i,o){var s=Array.isArray(i),a="string"==typeof i?i:s?i.slice():T({},i);if(s)for(var t=0,e=i.length;t<e;t++)K(t,a,i,o);else if("object"===m(i))for(var r in i)K(r,a,i,o);else if("string"==typeof i){i=H(i),o=H(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++;for(var u={isString:!0,length:i.length},f={isString:!0,length:o.length};n<u.length;)u[n]=i[n],f[n]=o[n],n++}return function(t){if(s)for(var e=0,r=i.length;e<r;e++)Y(e,a,i,o,t);else if("object"===m(a))for(var n in i)Y(n,a,i,o,t);else"string"==typeof a&&(a=Y(0,0,i,o,t,t,!0));return a}},t.onTick=function(t){return a.push({update:t})},t.has=function(t){return null!==n(t)},t.get=n,t.getAll=function(){return a},t.removeAll=function(){a.length=0,s(o),u=!1},t.remove=x,t.add=v,t.now=F,t.update=i,t.autoPlay=function(t){f=t},t.isRunning=C,t.onRequestTick=function(t){l.push(t)},t.FrameThrottle=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:120;p=1.05*t},t.ToggleLagSmoothing=function(){var t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];d=t},t.Tween=lt,t.Timeline=pt,t.Easing=y,t.Interpolation=it,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 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 E(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",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})$/i,X=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 H(t){return"string"!=typeof t?t:t.replace(L,X).match(P).map(function(t){return I(t)?t:+t})}function K(r,n,t,e,i){var o=t[r],s=e[r];if("string"==typeof o||"string"==typeof s){for(var a=Array.isArray(o)&&o[0]===M?o:H(o),u=Array.isArray(s)&&s[0]===M?s:H(s),f=1;f<a.length;)a[f]===u[f]&&"string"==typeof a[f-1]?(a.splice(f-1,2,a[f-1]+a[f]),u.splice(f-1,2,u[f-1]+u[f])):f++;a[f=0]===M&&a.shift(),u[0]===M&&u.shift();for(var l={isString:!0,length:a.length},h={isString:!0,length:u.length};f<l.length;)l[f]=a[f],h[f]=u[f],f++;return t[r]=l,e[r]=h,!0}if("object"!==m(o)||"object"!==m(s))return!1;if(Array.isArray(o))return o.map(function(t,e){return K(e,n[r],o,s)});for(var c in s)K(c,n[r],o,s);return!0}var W="rgba(",$=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 Y(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;($(a,l)||$(a,l,W))&&(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]&&Y(d,e[t],a,u,i,o);else if("object"===m(a)&&a&&!a.isString)for(var y in a)a[y]!==u[y]&&Y(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 Z(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("["))Z(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("["))Z(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("[")||Z(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:S,EVENT_STOP:"stop",EVENT_SEEK:"seek",STRING_PROP:M,NUM_REGEX:P,HEXC_REGEX:/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,deepCopy:R,decomposeString:H,decompose:K,RGB:"rgb(",RGBA:W,isRGBColor:$,recompose:Y,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("string"==typeof t)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){if(t[0]===M){for(var i="",o=1,s=t.length;o<s;o++){var a="number"==typeof t[o]?t[o]+(e[o]-t[o])*r:e[o];($(t,o)||$(t,o,W))&&(a|=0),i+=a}return i}for(var u=0,f=n.length;u<f;u++)n[u]=it.Utils.Linear(t[u],e[u],r,n[u])}else for(var l in n)n[l]=it.Utils.Linear(t[l],e[l],r,n[l]);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];($(t,l)||$(t,l,W))&&(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);i.object=T({},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+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,i){var o=this._maxListener,s=t+A;if(!this[s+0])return this;for(var a=0;a<o;a++){var u=s+a;this[u]&&this[u](e,r,n,i)}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=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)&&!Array.isArray(u)){f.unshift(u);for(var l=0,h=f.length;l<h;l++)if("string"==typeof f[l]){for(var c=H(f[l]),p={length:c.length,isString:!0},d=0,v=c.length;d<v;d++)p[d]=c[d];f[l]=p}}"number"==typeof(t[a]=u)&&"string"==typeof f&&"="===f[1]||K(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,E=0;if(_){var j=(t=void 0!==t?t:C())-y;if(this._prevTime=t,250<j&&F()&&x()&&(t-=j-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 A=m[o];if(null!=A||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]=A+(S-A)*M:Array.isArray(S)&&!Array.isArray(A)?b[o]=P(S,M,b[o]):S&&S.update?S.update(M):"function"==typeof S?b[o]=S(M):"string"==typeof S&&"number"==typeof A?b[o]=A+parseFloat(S[0]+S.substr(2))*M:Y(o,b,m,g,M,n),q[o]&&q[o].update&&q[o].update.call(this,b[o],A,S,M,n,o),E++}}if(!E)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=E(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,E(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),a="string"==typeof i?i:s?i.slice():T({},i);if(s)for(var t=0,e=i.length;t<e;t++)K(t,a,i,o);else if("object"===m(i))for(var r in i)K(r,a,i,o);else if("string"==typeof i){i=H(i),o=H(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++;for(var u={isString:!0,length:i.length},f={isString:!0,length:o.length};n<u.length;)u[n]=i[n],f[n]=o[n],n++}return function(t){if(s)for(var e=0,r=i.length;e<r;e++)Y(e,a,i,o,t);else if("object"===m(a))for(var n in i)Y(n,a,i,o,t);else"string"==typeof a&&(a=Y(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})}); |
@@ -11,15 +11,15 @@ # Contributor Covenant Code of Conduct | ||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
- Using welcoming and inclusive language | ||
- Being respectful of differing viewpoints and experiences | ||
- Gracefully accepting constructive criticism | ||
- Focusing on what is best for the community | ||
- Showing empathy towards other community members | ||
Examples of unacceptable behavior by participants include: | ||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
- The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
- Trolling, insulting/derogatory comments, and personal or political attacks | ||
- Public or private harassment | ||
- Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
- Other conduct which could reasonably be considered inappropriate in a professional setting | ||
@@ -47,2 +47,2 @@ ## Our Responsibilities | ||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ | ||
[version]: http://contributor-covenant.org/version/1/4/ |
{ | ||
"tags": { | ||
"allowUnknownTags": true, | ||
"dictionaries": ["jsdoc"] | ||
"dictionaries": [ | ||
"jsdoc" | ||
] | ||
}, | ||
"source": { | ||
"include": ["src"], | ||
"include": [ | ||
"src" | ||
], | ||
"includePattern": ".js$", | ||
"excludePattern": "(node_modules/|docs)" | ||
"excludePattern": "(node_modules/|logo|docs|bundled|examples|performance|.vscode|.github)" | ||
}, | ||
@@ -25,2 +29,2 @@ "plugins": [ | ||
} | ||
} | ||
} |
{ | ||
"name": "es6-tween", | ||
"version": "5.5.2", | ||
"version": "5.5.3", | ||
"description": "ES6 implementation of amazing tween.js", | ||
@@ -15,8 +15,8 @@ "browser": "bundled/Tween.min.js", | ||
"minify": "npx uglifyjs bundled/Tween.js -c -m -o bundled/Tween.min.js --source-map \"filename='bundled/Tween.min.js.map'\"", | ||
"build": "yarn source && yarn minify", | ||
"build": "npm run source && npm run minify", | ||
"dev": "npx rollup -c -w", | ||
"prepublishOnly": "yarn build && yarn lint && yarn doc && yarn doc-md", | ||
"doc": "npx jsdoc --readme README.md --configure jsdoc.json --verbose", | ||
"prepublishOnly": "npm run build && npm run lint && npm run doc && npm run doc-md", | ||
"doc": "npx jsdoc --readme README.md --configure jsdoc.json --verbose --debug", | ||
"doc-md": "npx jsdoc2md src/** > API.md", | ||
"test": "yarn lint && npm run source && npx ava", | ||
"test": "npm run lint && npm run source && npx ava", | ||
"lint": "npx eslint ./src", | ||
@@ -56,3 +56,2 @@ "lint-fix": "npx eslint ./src --fix" | ||
"eslint-plugin-standard": "^4.0.0", | ||
"husky": "^1.3.1", | ||
"jsdoc": "^3.5.5", | ||
@@ -73,4 +72,3 @@ "jsdoc-to-markdown": "^3.1.0-1", | ||
"extensions": [ | ||
"js", | ||
"mjs" | ||
"js" | ||
] | ||
@@ -77,0 +75,0 @@ } |
@@ -36,3 +36,3 @@ # es6-tween | ||
.to({ x: 100, y: 100 }, 1000) | ||
.on("update", ({ x, y }) => { | ||
.on('update', ({ x, y }) => { | ||
console.log(`The values is x: ${x} and y: ${y}`); | ||
@@ -55,3 +55,3 @@ }) | ||
Download the [library](https://raw.githubusercontent.com/tweenjs/es6-tween/master/ts/Tween.ts) and include it in your code: | ||
Download the [library](https://unpkg.com/es6-tween/bundled/Tween.js) and include it in your code: | ||
@@ -85,3 +85,3 @@ ```html | ||
```javascript | ||
import { Easing, Tween, autoPlay } from "es6-tween"; | ||
import { Easing, Tween, autoPlay } from 'es6-tween'; | ||
``` | ||
@@ -114,3 +114,3 @@ | ||
```javascript | ||
const { Tween, Easing, autoPlay } = require("es6-tween"); | ||
const { Tween, Easing, autoPlay } = require('es6-tween'); | ||
``` | ||
@@ -117,0 +117,0 @@ |
@@ -12,5 +12,3 @@ import babel from 'rollup-plugin-babel' | ||
context: 'this', | ||
plugins: [ | ||
babel() | ||
] | ||
plugins: [babel()] | ||
} |
@@ -42,4 +42,3 @@ // Frame lag-fix constants | ||
const isNaNForST = v => | ||
isNaN(+v) || ((v[0] === '+' || v[0] === '-') && v[1] === '=') || v === '' || v === ' ' | ||
const isNaNForST = (v) => isNaN(+v) || ((v[0] === '+' || v[0] === '-') && v[1] === '=') || v === '' || v === ' ' | ||
@@ -58,4 +57,4 @@ const hexColor = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i | ||
let color = parseInt(hex, 16) | ||
r = color >> 16 & 255 | ||
g = color >> 8 & 255 | ||
r = (color >> 16) & 255 | ||
g = (color >> 8) & 255 | ||
b = color & 255 | ||
@@ -66,3 +65,8 @@ return 'rgb(' + r + ',' + g + ',' + b + ')' | ||
export function decomposeString (fromValue) { | ||
return typeof fromValue !== 'string' ? fromValue : fromValue.replace(hexColor, hex2rgb).match(NUM_REGEX).map(v => (isNaNForST(v) ? v : +v)) | ||
return typeof fromValue !== 'string' | ||
? fromValue | ||
: fromValue | ||
.replace(hexColor, hex2rgb) | ||
.match(NUM_REGEX) | ||
.map((v) => (isNaNForST(v) ? v : +v)) | ||
} | ||
@@ -118,5 +122,3 @@ | ||
if (Array.isArray(fromValue)) { | ||
return fromValue.map((v, i) => | ||
decompose(i, obj[prop], fromValue, toValue) | ||
) | ||
return fromValue.map((v, i) => decompose(i, obj[prop], fromValue, toValue)) | ||
} else { | ||
@@ -137,4 +139,3 @@ for (let prop2 in toValue) { | ||
export const isRGBColor = (v, i, r = RGB) => | ||
typeof v[i] === 'number' && | ||
(v[i - 1] === r || v[i - 3] === r || v[i - 5] === r) | ||
typeof v[i] === 'number' && (v[i - 1] === r || v[i - 3] === r || v[i - 5] === r) | ||
export function recompose (prop, obj, from, to, t, originalT, stringBuffer) { | ||
@@ -146,7 +147,3 @@ const fromValue = stringBuffer ? from : from[prop] | ||
} | ||
if ( | ||
fromValue === undefined || | ||
typeof fromValue === 'string' || | ||
fromValue === toValue | ||
) { | ||
if (fromValue === undefined || typeof fromValue === 'string' || fromValue === toValue) { | ||
return toValue | ||
@@ -165,4 +162,3 @@ } else if (typeof fromValue === 'object' && typeof toValue === 'object') { | ||
: isRelative | ||
? fromValue[i] + | ||
parseFloat(toValue[i][0] + toValue[i].substr(2)) * t | ||
? fromValue[i] + parseFloat(toValue[i][0] + toValue[i].substr(2)) * t | ||
: fromValue[i] + (toValue[i] - fromValue[i]) * t | ||
@@ -174,5 +170,3 @@ if (isRGBColor(fromValue, i) || isRGBColor(fromValue, i, RGBA)) { | ||
if (isRelative && originalT === 1) { | ||
fromValue[i] = | ||
fromValue[i] + | ||
parseFloat(toValue[i][0] + toValue[i].substr(2)) | ||
fromValue[i] = fromValue[i] + parseFloat(toValue[i][0] + toValue[i].substr(2)) | ||
} | ||
@@ -201,6 +195,5 @@ } | ||
const isRelative = typeof toValue === 'string' | ||
obj[prop] = | ||
isRelative | ||
? fromValue + parseFloat(toValue[0] + toValue.substr(2)) * t | ||
: fromValue + (toValue - fromValue) * t | ||
obj[prop] = isRelative | ||
? fromValue + parseFloat(toValue[0] + toValue.substr(2)) * t | ||
: fromValue + (toValue - fromValue) * t | ||
if (isRelative && originalT === 1) { | ||
@@ -252,6 +245,3 @@ from[prop] = obj[prop] | ||
if (lastArr || lastObj) { | ||
nested[prop] = | ||
index === propsLastIndex | ||
? value | ||
: lastArr || nextIsArray ? [] : lastObj ? {} : null | ||
nested[prop] = index === propsLastIndex ? value : lastArr || nextIsArray ? [] : lastObj ? {} : null | ||
lastObj = lastArr = false | ||
@@ -258,0 +248,0 @@ return nested[prop] |
@@ -12,3 +12,7 @@ /* global process */ | ||
const now = (function () { | ||
if (typeof process !== 'undefined' && process.hrtime !== undefined && (!process.versions || process.versions.electron === undefined)) { | ||
if ( | ||
typeof process !== 'undefined' && | ||
process.hrtime !== undefined && | ||
(!process.versions || process.versions.electron === undefined) | ||
) { | ||
return function () { | ||
@@ -21,6 +25,3 @@ const time = process.hrtime() | ||
// In a browser, use window.performance.now if it is available. | ||
} else if ( | ||
root.performance !== undefined && | ||
root.performance.now !== undefined | ||
) { | ||
} else if (root.performance !== undefined && root.performance.now !== undefined) { | ||
// This must be bound, because directly assigning this function | ||
@@ -32,5 +33,3 @@ // leads to an invocation exception in Chrome. | ||
const offset = | ||
root.performance && | ||
root.performance.timing && | ||
root.performance.timing.navigationStart | ||
root.performance && root.performance.timing && root.performance.timing.navigationStart | ||
? root.performance.timing.navigationStart | ||
@@ -110,3 +109,3 @@ : Date.now() | ||
* Sets after how much frames empty updating should stop | ||
* @param {number} [frameCount=120] count of frames that should stop after all tweens removed | ||
* @param {number} frameCount=120 count of frames that should stop after all tweens removed | ||
* @memberof TWEEN | ||
@@ -122,3 +121,3 @@ * @example | ||
* Handle lag, useful if you have rendering Canvas or DOM objects or using es6-tween plugins | ||
* @param {number} [state=true] handle lag state | ||
* @param {number} state=true handle lag state | ||
* @memberof TWEEN | ||
@@ -125,0 +124,0 @@ * @example |
@@ -18,3 +18,3 @@ /** | ||
In (k) { | ||
return k * k | ||
return Math.pow(k, 2) | ||
}, | ||
@@ -28,3 +28,3 @@ | ||
if ((k *= 2) < 1) { | ||
return 0.5 * k * k | ||
return 0.5 * Math.pow(k, 2) | ||
} | ||
@@ -38,3 +38,3 @@ | ||
In (k) { | ||
return k * k * k | ||
return Math.pow(k, 3) | ||
}, | ||
@@ -48,3 +48,3 @@ | ||
if ((k *= 2) < 1) { | ||
return 0.5 * k * k * k | ||
return 0.5 * Math.pow(k, 3) | ||
} | ||
@@ -58,3 +58,3 @@ | ||
In (k) { | ||
return k * k * k * k | ||
return Math.pow(k, 4) | ||
}, | ||
@@ -68,3 +68,3 @@ | ||
if ((k *= 2) < 1) { | ||
return 0.5 * k * k * k * k | ||
return 0.5 * Math.pow(k, 4) | ||
} | ||
@@ -78,3 +78,3 @@ | ||
In (k) { | ||
return k * k * k * k * k | ||
return Math.pow(k, 5) | ||
}, | ||
@@ -88,3 +88,3 @@ | ||
if ((k *= 2) < 1) { | ||
return 0.5 * k * k * k * k * k | ||
return 0.5 * Math.pow(k, 5) | ||
} | ||
@@ -98,7 +98,7 @@ | ||
In (k) { | ||
return 1 - Math.cos(k * Math.PI / 2) | ||
return 1 - Math.cos((k * Math.PI) / 2) | ||
}, | ||
Out (k) { | ||
return Math.sin(k * Math.PI / 2) | ||
return Math.sin((k * Math.PI) / 2) | ||
}, | ||
@@ -192,10 +192,6 @@ | ||
if (k < 1) { | ||
return ( | ||
-0.5 * Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) | ||
) | ||
return -0.5 * Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) | ||
} | ||
return ( | ||
0.5 * Math.pow(2, -10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) + 1 | ||
) | ||
return 0.5 * Math.pow(2, -10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) + 1 | ||
} | ||
@@ -234,10 +230,12 @@ }, | ||
Out (k) { | ||
if (k < 1 / 2.75) { | ||
return 7.5625 * k * k | ||
} else if (k < 2 / 2.75) { | ||
return 7.5625 * (k -= 1.5 / 2.75) * k + 0.75 | ||
} else if (k < 2.5 / 2.75) { | ||
return 7.5625 * (k -= 2.25 / 2.75) * k + 0.9375 | ||
let x = 2.75 | ||
let y = 7.5625 | ||
if (k < 1 / x) { | ||
return y * k * k | ||
} else if (k < 2 / x) { | ||
return y * (k -= 1.5 / x) * k + 0.75 | ||
} else if (k < 2.5 / x) { | ||
return y * (k -= 2.25 / x) * k + 0.9375 | ||
} else { | ||
return 7.5625 * (k -= 2.625 / 2.75) * k + 0.984375 | ||
return y * (k -= 2.625 / x) * k + 0.984375 | ||
} | ||
@@ -256,3 +254,3 @@ }, | ||
Stepped: { | ||
steps: steps => k => ((k * steps) | 0) / steps | ||
steps: (steps) => (k) => ((k * steps) | 0) / steps | ||
} | ||
@@ -259,0 +257,0 @@ } |
@@ -80,10 +80,3 @@ import { isRGBColor, RGBA, STRING_PROP } from './constants' | ||
return fn( | ||
v[(i - 1 + m) % m], | ||
v[i], | ||
v[(i + 1) % m], | ||
v[(i + 2) % m], | ||
f - i, | ||
value | ||
) | ||
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i, value) | ||
} else { | ||
@@ -98,10 +91,3 @@ if (k < 0) { | ||
return fn( | ||
v[i ? i - 1 : 0], | ||
v[i], | ||
v[m < i + 1 ? m : i + 1], | ||
v[m < i + 2 ? m : i + 2], | ||
f - i, | ||
value | ||
) | ||
return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i, value) | ||
} | ||
@@ -121,4 +107,3 @@ }, | ||
for (let i = 1, len = p0.length; i < len; i++) { | ||
let currentValue = | ||
typeof p0[i] === 'number' ? p0[i] + (p1[i] - p0[i]) * t : p1[i] | ||
let currentValue = typeof p0[i] === 'number' ? p0[i] + (p1[i] - p0[i]) * t : p1[i] | ||
if (isRGBColor(p0, i) || isRGBColor(p0, i, RGBA)) { | ||
@@ -169,3 +154,3 @@ currentValue |= 0 | ||
return n => { | ||
return (n) => { | ||
let s = 1 | ||
@@ -195,8 +180,3 @@ | ||
return ( | ||
(2 * p1 - 2 * p2 + v0 + v1) * t3 + | ||
(-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + | ||
v0 * t + | ||
p1 | ||
) | ||
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1 | ||
} else if (typeof p0 === 'object') { | ||
@@ -208,11 +188,3 @@ if (p0.length !== undefined) { | ||
let currentValue = | ||
typeof p0[i] === 'number' | ||
? Interpolation.Utils.CatmullRom( | ||
p0[i], | ||
p1[i], | ||
p2[i], | ||
p3[i], | ||
t | ||
) | ||
: p3[i] | ||
typeof p0[i] === 'number' ? Interpolation.Utils.CatmullRom(p0[i], p1[i], p2[i], p3[i], t) : p3[i] | ||
if (isRGBColor(p0, i) || isRGBColor(p0, i, RGBA)) { | ||
@@ -226,21 +198,7 @@ currentValue |= 0 | ||
for (let p = 0, len = v.length; p < len; p++) { | ||
v[p] = Interpolation.Utils.CatmullRom( | ||
p0[p], | ||
p1[p], | ||
p2[p], | ||
p3[p], | ||
t, | ||
v[p] | ||
) | ||
v[p] = Interpolation.Utils.CatmullRom(p0[p], p1[p], p2[p], p3[p], t, v[p]) | ||
} | ||
} else { | ||
for (const p in v) { | ||
v[p] = Interpolation.Utils.CatmullRom( | ||
p0[p], | ||
p1[p], | ||
p2[p], | ||
p3[p], | ||
t, | ||
v[p] | ||
) | ||
v[p] = Interpolation.Utils.CatmullRom(p0[p], p1[p], p2[p], p3[p], t, v[p]) | ||
} | ||
@@ -247,0 +205,0 @@ } |
@@ -1,4 +0,2 @@ | ||
import { | ||
remove | ||
} from './core' | ||
import { remove } from './core' | ||
@@ -16,7 +14,3 @@ export const Store = {} | ||
if (storeID) { | ||
if ( | ||
storeID.object === object && | ||
node === storeID.tween.node && | ||
tween._startTime === storeID.tween._startTime | ||
) { | ||
if (storeID.object === object && node === storeID.tween.node && tween._startTime === storeID.tween._startTime) { | ||
remove(storeID.tween) | ||
@@ -33,5 +27,3 @@ } else if (typeof object === 'object' && !!object && !!storeID.object) { | ||
} | ||
storeID.object = { ...storeID.object, | ||
...object | ||
} | ||
storeID.object = { ...storeID.object, ...object } | ||
} | ||
@@ -38,0 +30,0 @@ return storeID.object |
@@ -10,8 +10,3 @@ export default class PlaybackPosition { | ||
let i = labels.indexOf(name) | ||
if ( | ||
typeof name === 'string' && | ||
name.indexOf('=') !== -1 && | ||
!offset && | ||
i === -1 | ||
) { | ||
if (typeof name === 'string' && name.indexOf('=') !== -1 && !offset && i === -1) { | ||
const rty = name.substr(name.indexOf('=') - 1, 2) | ||
@@ -18,0 +13,0 @@ const rt = name.split(rty) |
@@ -5,3 +5,4 @@ export default function (selector, collection, allowRaw) { | ||
? null | ||
: (typeof window !== 'undefined' && selector === window) || (typeof document !== 'undefined' && selector === document) | ||
: (typeof window !== 'undefined' && selector === window) || | ||
(typeof document !== 'undefined' && selector === document) | ||
? [selector] | ||
@@ -12,7 +13,12 @@ : typeof selector === 'string' | ||
? selector | ||
: selector.nodeType ? [selector] : allowRaw ? selector : [] | ||
: selector.nodeType | ||
? [selector] | ||
: allowRaw | ||
? selector | ||
: [] | ||
} | ||
return !selector | ||
? null | ||
: (typeof window !== 'undefined' && selector === window) || (typeof document !== 'undefined' && selector === document) | ||
: (typeof window !== 'undefined' && selector === window) || | ||
(typeof document !== 'undefined' && selector === document) | ||
? selector | ||
@@ -23,3 +29,7 @@ : typeof selector === 'string' | ||
? selector[0] | ||
: selector.nodeType ? selector : allowRaw ? selector : null | ||
: selector.nodeType | ||
? selector | ||
: allowRaw | ||
? selector | ||
: null | ||
} |
/* global global, self */ | ||
export let root = | ||
typeof self !== 'undefined' | ||
? self : typeof window !== 'undefined' | ||
? self | ||
: typeof window !== 'undefined' | ||
? window | ||
: typeof global !== 'undefined' | ||
? global : this || (typeof exports !== 'undefined' | ||
? exports : {}) | ||
export let requestAnimationFrame = | ||
root.requestAnimationFrame || | ||
((fn) => root.setTimeout(fn, 50 / 3)) | ||
export let cancelAnimationFrame = | ||
root.cancelAnimationFrame || | ||
((id) => root.clearTimeout(id)) | ||
? global | ||
: this || (typeof exports !== 'undefined' ? exports : {}) | ||
export let requestAnimationFrame = root.requestAnimationFrame || ((fn) => root.setTimeout(fn, 50 / 3)) | ||
export let cancelAnimationFrame = root.cancelAnimationFrame || ((id) => root.clearTimeout(id)) |
@@ -16,3 +16,3 @@ import { add, now, remove, isRunning, isLagSmoothing } from './core' | ||
export const shuffle = a => { | ||
export const shuffle = (a) => { | ||
let j | ||
@@ -46,3 +46,3 @@ let x | ||
this._duration = 0 | ||
this._startTime = params.startTime !== undefined ? params.startTime : now() | ||
this._startTime = params && params.startTime !== undefined ? params.startTime : now() | ||
this._tweens = [] | ||
@@ -64,3 +64,3 @@ this.elapsed = 0 | ||
timingOrder (fn) { | ||
const timing = fn(this._tweens.map(t => t._startTime)) | ||
const timing = fn(this._tweens.map((t) => t._startTime)) | ||
this._tweens.map((tween, i) => { | ||
@@ -77,3 +77,3 @@ tween._startTime = timing[i] | ||
} else if (mode === 'async') { | ||
return nodes.map(node => offset) | ||
return nodes.map((node) => offset) | ||
} else if (mode === 'sequence' || mode === 'delayed') { | ||
@@ -86,3 +86,3 @@ let { stagger } = params | ||
} else if (mode === 'oneByOne') { | ||
return nodes.map(node => params.duration) | ||
return nodes.map((node) => params.duration) | ||
} else if (mode === 'shuffle') { | ||
@@ -116,6 +116,3 @@ const { stagger } = params | ||
? position | ||
: this.position.parseLabel( | ||
typeof position !== 'undefined' ? position : 'afterLast', | ||
null | ||
) | ||
: this.position.parseLabel(typeof position !== 'undefined' ? position : 'afterLast', null) | ||
const mode = this.getTiming(params.mode, nodes, params, offset) | ||
@@ -127,3 +124,7 @@ for (let i = 0, node, len = nodes.length; i < len; i++) { | ||
node, | ||
typeof from === 'function' ? from(i, nodes.length) : typeof from === 'object' && !!from ? { ...from } : null, | ||
typeof from === 'function' | ||
? from(i, nodes.length) | ||
: typeof from === 'object' && !!from | ||
? { ...from } | ||
: null, | ||
typeof to === 'function' ? to(i, nodes.length) : to, | ||
@@ -179,6 +180,3 @@ typeof params === 'function' ? params(i, nodes.length) : params | ||
fn(_tween, i) | ||
this._duration = Math.max( | ||
this._duration, | ||
_tween._duration + _tween._startTime | ||
) | ||
this._duration = Math.max(this._duration, _tween._duration + _tween._startTime) | ||
} | ||
@@ -197,3 +195,3 @@ return this | ||
if (Array.isArray(tween)) { | ||
tween.map(_tween => { | ||
tween.map((_tween) => { | ||
this.add(_tween, position) | ||
@@ -219,13 +217,7 @@ }) | ||
? position | ||
: this.position.parseLabel( | ||
typeof position !== 'undefined' ? position : 'afterLast', | ||
null | ||
) | ||
: this.position.parseLabel(typeof position !== 'undefined' ? position : 'afterLast', null) | ||
tween._startTime = Math.max(this._startTime, tween._delayTime, offset) | ||
tween._delayTime = offset | ||
tween._isPlaying = true | ||
this._duration = Math.max( | ||
_duration, | ||
Math.max(tween._startTime + tween._delayTime, tween._duration) | ||
) | ||
this._duration = Math.max(_duration, Math.max(tween._startTime + tween._delayTime, tween._duration)) | ||
this._tweens.push(tween) | ||
@@ -245,7 +237,7 @@ this.position.setLabel('afterLast', this._duration) | ||
easing (easing) { | ||
return this.map(tween => tween.easing(easing)) | ||
return this.map((tween) => tween.easing(easing)) | ||
} | ||
interpolation (interpolation) { | ||
return this.map(tween => tween.interpolation(interpolation)) | ||
return this.map((tween) => tween.interpolation(interpolation)) | ||
} | ||
@@ -314,3 +306,3 @@ | ||
this._reversed = !_reversed | ||
this.timingOrder(timing => timing.reverse()) | ||
this.timingOrder((timing) => timing.reverse()) | ||
} | ||
@@ -346,7 +338,5 @@ | ||
progress (value) { | ||
return value !== undefined | ||
? this.update(value * this._duration) | ||
: this.elapsed | ||
return value !== undefined ? this.update(value * this._duration) : this.elapsed | ||
} | ||
} | ||
export default Timeline |
140
src/Tween.js
@@ -1,14 +0,5 @@ | ||
import { | ||
add, | ||
now, | ||
Plugins, | ||
remove, | ||
isRunning, | ||
isLagSmoothing | ||
} from './core' | ||
import { add, now, Plugins, remove, isRunning, isLagSmoothing } from './core' | ||
import Easing from './Easing' | ||
import Interpolation from './Interpolation' | ||
import NodeCache, { | ||
Store | ||
} from './NodeCache' | ||
import NodeCache, { Store } from './NodeCache' | ||
import Selector from './selector' | ||
@@ -99,5 +90,3 @@ import { | ||
node = null | ||
} else if (!!node && | ||
(node.nodeType || node.length || typeof node === 'string') | ||
) { | ||
} else if (!!node && (node.nodeType || node.length || typeof node === 'string')) { | ||
node = this.node = Selector(node) | ||
@@ -150,5 +139,3 @@ object = this.object = NodeCache(node, object, this) | ||
on (event, callback) { | ||
const { | ||
_maxListener | ||
} = this | ||
const { _maxListener } = this | ||
const callbackName = event + EVENT_CALLBACK | ||
@@ -173,5 +160,3 @@ for (let i = 0; i < _maxListener; i++) { | ||
once (event, callback) { | ||
const { | ||
_maxListener | ||
} = this | ||
const { _maxListener } = this | ||
const callbackName = event + EVENT_CALLBACK | ||
@@ -198,5 +183,3 @@ for (let i = 0; i < _maxListener; i++) { | ||
off (event, callback) { | ||
const { | ||
_maxListener | ||
} = this | ||
const { _maxListener } = this | ||
const callbackName = event + EVENT_CALLBACK | ||
@@ -218,5 +201,3 @@ for (let i = 0; i < _maxListener; i++) { | ||
emit (event, arg1, arg2, arg3, arg4) { | ||
const { | ||
_maxListener | ||
} = this | ||
const { _maxListener } = this | ||
const callbackName = event + EVENT_CALLBACK | ||
@@ -261,5 +242,3 @@ | ||
reverse (state) { | ||
const { | ||
_reversed | ||
} = this | ||
const { _reversed } = this | ||
@@ -342,8 +321,3 @@ this._reversed = state !== undefined ? state : !_reversed | ||
seek (time, keepPlaying) { | ||
const { | ||
_duration, | ||
_initTime, | ||
_startTime, | ||
_reversed | ||
} = this | ||
const { _duration, _initTime, _startTime, _reversed } = this | ||
@@ -372,4 +346,3 @@ let updateTime = _initTime + time | ||
duration (amount) { | ||
this._duration = | ||
typeof amount === 'function' ? amount(this._duration) : amount | ||
this._duration = typeof amount === 'function' ? amount(this._duration) : amount | ||
@@ -390,13 +363,9 @@ return this | ||
if (typeof duration === 'number' || typeof duration === 'function') { | ||
this._duration = | ||
typeof duration === 'function' ? duration(this._duration) : duration | ||
this._duration = typeof duration === 'function' ? duration(this._duration) : duration | ||
} else if (typeof duration === 'object') { | ||
for (const prop in duration) { | ||
if (typeof this[prop] === 'function') { | ||
const [ | ||
arg1 = null, | ||
arg2 = null, | ||
arg3 = null, | ||
arg4 = null | ||
] = Array.isArray(duration[prop]) ? duration[prop] : [duration[prop]] | ||
const [arg1 = null, arg2 = null, arg3 = null, arg4 = null] = Array.isArray(duration[prop]) | ||
? duration[prop] | ||
: [duration[prop]] | ||
this[prop](arg1, arg2, arg3, arg4) | ||
@@ -419,9 +388,3 @@ } | ||
} | ||
let { | ||
_valuesStart, | ||
_valuesEnd, | ||
object, | ||
node, | ||
InitialValues | ||
} = this | ||
let { _valuesStart, _valuesEnd, object, node, InitialValues } = this | ||
@@ -433,6 +396,3 @@ SET_NESTED(object) | ||
const prevTweenByNode = Store[node.queueID] | ||
if ( | ||
prevTweenByNode.propNormaliseRequired && | ||
prevTweenByNode.tween !== this | ||
) { | ||
if (prevTweenByNode.propNormaliseRequired && prevTweenByNode.tween !== this) { | ||
for (const property in _valuesEnd) { | ||
@@ -450,7 +410,3 @@ if (prevTweenByNode.tween._valuesEnd[property] !== undefined) { | ||
if (!object || Object.keys(object).length === 0) { | ||
object = this.object = NodeCache( | ||
node, | ||
InitialValues(node, _valuesEnd), | ||
this | ||
) | ||
object = this.object = NodeCache(node, InitialValues(node, _valuesEnd), this) | ||
} else if (!_valuesEnd || Object.keys(_valuesEnd).length === 0) { | ||
@@ -522,6 +478,3 @@ _valuesEnd = this._valuesEnd = InitialValues(node, object) | ||
start (time) { | ||
this._startTime = | ||
time !== undefined | ||
? typeof time === 'string' ? now() + parseFloat(time) : time | ||
: now() | ||
this._startTime = time !== undefined ? (typeof time === 'string' ? now() + parseFloat(time) : time) : now() | ||
this._startTime += this._delayTime | ||
@@ -545,12 +498,3 @@ this._initTime = this._prevTime = this._startTime | ||
stop () { | ||
let { | ||
_isPlaying, | ||
_isFinite, | ||
object, | ||
_startTime, | ||
_duration, | ||
_r, | ||
_yoyo, | ||
_reversed | ||
} = this | ||
let { _isPlaying, _isFinite, object, _startTime, _duration, _r, _yoyo, _reversed } = this | ||
@@ -582,4 +526,3 @@ if (!_isPlaying) { | ||
delay (amount) { | ||
this._delayTime = | ||
typeof amount === 'function' ? amount(this._delayTime) : amount | ||
this._delayTime = typeof amount === 'function' ? amount(this._delayTime) : amount | ||
@@ -614,5 +557,3 @@ return this | ||
repeat (amount) { | ||
this._repeat = !this._duration | ||
? 0 | ||
: typeof amount === 'function' ? amount(this._repeat) : amount | ||
this._repeat = !this._duration ? 0 : typeof amount === 'function' ? amount(this._repeat) : amount | ||
this._r = this._repeat | ||
@@ -631,4 +572,3 @@ this._isFinite = isFinite(amount) | ||
reverseDelay (amount) { | ||
this._reverseDelayTime = | ||
typeof amount === 'function' ? amount(this._reverseDelayTime) : amount | ||
this._reverseDelayTime = typeof amount === 'function' ? amount(this._reverseDelayTime) : amount | ||
@@ -646,6 +586,3 @@ return this | ||
yoyo (state, _easingReverse) { | ||
this._yoyo = | ||
typeof state === 'function' | ||
? state(this._yoyo) | ||
: state === null ? this._yoyo : state | ||
this._yoyo = typeof state === 'function' ? state(this._yoyo) : state === null ? this._yoyo : state | ||
if (!state) { | ||
@@ -691,7 +628,3 @@ this._reversed = false | ||
reassignValues (time) { | ||
const { | ||
_valuesStart, | ||
object, | ||
_delayTime | ||
} = this | ||
const { _valuesStart, object, _delayTime } = this | ||
@@ -781,5 +714,3 @@ this._isPlaying = true | ||
currentEasing = _reversed | ||
? _easingReverse || _easingFunction | ||
: _easingFunction | ||
currentEasing = _reversed ? _easingReverse || _easingFunction : _easingFunction | ||
@@ -792,6 +723,3 @@ if (!object) { | ||
const start = _valuesStart[property] | ||
if ( | ||
(start === undefined || start === null) && | ||
!(Plugins[property] && Plugins[property].update) | ||
) { | ||
if ((start === undefined || start === null) && !(Plugins[property] && Plugins[property].update)) { | ||
continue | ||
@@ -814,7 +742,3 @@ } | ||
} else if (Array.isArray(end) && !Array.isArray(start)) { | ||
object[property] = _interpolationFunctionCall( | ||
end, | ||
value, | ||
object[property] | ||
) | ||
object[property] = _interpolationFunctionCall(end, value, object[property]) | ||
} else if (end && end.update) { | ||
@@ -830,11 +754,3 @@ end.update(value) | ||
if (Plugins[property] && Plugins[property].update) { | ||
Plugins[property].update.call( | ||
this, | ||
object[property], | ||
start, | ||
end, | ||
value, | ||
elapsed, | ||
property | ||
) | ||
Plugins[property].update.call(this, object[property], start, end, value, elapsed, property) | ||
} | ||
@@ -841,0 +757,0 @@ propCount++ |
357
test.js
@@ -9,3 +9,3 @@ /* global TWEEN */ | ||
test('Events', t => { | ||
test('Events', (t) => { | ||
let tween = new Tween({ x: 0 }) | ||
@@ -51,7 +51,9 @@ .to({ x: 100 }, 100) | ||
test('Value Interpolation', t => { | ||
test('Value Interpolation', (t) => { | ||
let obj = { a: 0, b: 'B value 1', c: { x: 2 }, d: [3], _e: 4, g: 5, h: 0 } | ||
Object.defineProperty(obj, 'e', { | ||
get () { return obj._e }, | ||
get () { | ||
return obj._e | ||
}, | ||
set (x) { | ||
@@ -62,5 +64,3 @@ obj._e = x | ||
new Tween(obj) | ||
.to({ a: 1, b: 'B value 2', c: { x: 3 }, d: [4], _e: 5, g: '+=1', h: 250000 }, 100) | ||
.start(0) | ||
new Tween(obj).to({ a: 1, b: 'B value 2', c: { x: 3 }, d: [4], _e: 5, g: '+=1', h: 250000 }, 100).start(0) | ||
@@ -111,7 +111,5 @@ update(0) | ||
test('Value Array-based Interpolation', t => { | ||
test('Value Array-based Interpolation', (t) => { | ||
let obj = { x: 0 } | ||
new Tween(obj) | ||
.to({ x: [1, 3, 5] }, 100) | ||
.start(0) | ||
new Tween(obj).to({ x: [1, 3, 5] }, 100).start(0) | ||
@@ -130,3 +128,3 @@ t.is(obj.x, 0) | ||
test('Tweens List Controlling', t => { | ||
test('Tweens List Controlling', (t) => { | ||
let tween = new Tween({ x: 0 }) | ||
@@ -138,4 +136,3 @@ .to({ x: 100 }, 100) | ||
t.is(getAll() | ||
.length, 1, 'Tween added in tweens list') | ||
t.is(getAll().length, 1, 'Tween added in tweens list') | ||
t.log('Tweens adding was done') | ||
@@ -145,4 +142,3 @@ | ||
t.is(getAll() | ||
.length, 0, 'Tween removed from tweens list') | ||
t.is(getAll().length, 0, 'Tween removed from tweens list') | ||
t.log('Tween removing was done') | ||
@@ -152,4 +148,3 @@ | ||
t.is(getAll() | ||
.length, 1, 'Tween added in tweens list') | ||
t.is(getAll().length, 1, 'Tween added in tweens list') | ||
t.log('Tweens restart and re-add to tweens list was done') | ||
@@ -159,8 +154,7 @@ | ||
t.is(getAll() | ||
.length, 0, 'All Tweens was removed from tweens list') | ||
t.is(getAll().length, 0, 'All Tweens was removed from tweens list') | ||
t.log('Tween removeAll was worked fine') | ||
}) | ||
test('Easing', t => { | ||
test('Easing', (t) => { | ||
const { Quadratic, Elastic, Linear } = Easing | ||
@@ -182,3 +176,3 @@ | ||
test('Tween update should be run against all tween each time', t => { | ||
test('Tween update should be run against all tween each time', (t) => { | ||
const order = [] | ||
@@ -215,3 +209,3 @@ | ||
test('Tween should work after recall when using power saving feature', t => { | ||
test('Tween should work after recall when using power saving feature', (t) => { | ||
const init = (obj) => | ||
@@ -243,174 +237,181 @@ new Tween(obj) | ||
test('Headless tests', browserTestMiddleware, (t, page) => { | ||
return page.evaluate(() => { | ||
const deepArrayCopy = arr => arr.map(child => Array.isArray(child) | ||
? deepArrayCopy(child) : Object.keys(child) && Object.keys(child).length | ||
? Object.assign({}, child) : child) | ||
return page | ||
.evaluate(() => { | ||
const deepArrayCopy = (arr) => | ||
arr.map((child) => | ||
Array.isArray(child) | ||
? deepArrayCopy(child) | ||
: Object.keys(child) && Object.keys(child).length | ||
? Object.assign({}, child) | ||
: child | ||
) | ||
const tests = [] | ||
const tests = [] | ||
const obj = { x: 0, y: [50, 'String test 100'] } | ||
const obj2 = { x: 0 } | ||
const arr1 = [ [ 100 ], { f: 200 } ] | ||
const obj = { x: 0, y: [50, 'String test 100'] } | ||
const obj2 = { x: 0 } | ||
const arr1 = [[100], { f: 200 }] | ||
const tween1 = new TWEEN.Tween(obj) | ||
.to({ x: 200, y: [100, 'String test 200'] }, 2000) | ||
.on('start', () => { | ||
tests.push({ | ||
method: 'log', | ||
successMessage: 'on:start event works as excepted' | ||
const tween1 = new TWEEN.Tween(obj) | ||
.to({ x: 200, y: [100, 'String test 200'] }, 2000) | ||
.on('start', () => { | ||
tests.push({ | ||
method: 'log', | ||
successMessage: 'on:start event works as excepted' | ||
}) | ||
}) | ||
}) | ||
.on('update', (obj, elapsed) => { | ||
tests.push({ | ||
method: 'log', | ||
successMessage: 'on:update event works as excepted with elapsed ' + elapsed | ||
.on('update', (obj, elapsed) => { | ||
tests.push({ | ||
method: 'log', | ||
successMessage: 'on:update event works as excepted with elapsed ' + elapsed | ||
}) | ||
}) | ||
}) | ||
.on('complete', () => { | ||
tests.push({ | ||
method: 'log', | ||
successMessage: 'on:complete event works as excepted' | ||
.on('complete', () => { | ||
tests.push({ | ||
method: 'log', | ||
successMessage: 'on:complete event works as excepted' | ||
}) | ||
}) | ||
}) | ||
const tween2 = new TWEEN.Tween(obj2).to({ x: 200 }, 4000).easing(TWEEN.Easing.Elastic.InOut) | ||
const tween3 = new TWEEN.Tween(arr1).to([ [ 0 ], { f: 100 } ], 2000) | ||
const tween2 = new TWEEN.Tween(obj2).to({ x: 200 }, 4000).easing(TWEEN.Easing.Elastic.InOut) | ||
const tween3 = new TWEEN.Tween(arr1).to([[0], { f: 100 }], 2000) | ||
tween1.start(0) | ||
tween2.start(0) | ||
tween3.start(0) | ||
tween1.start(0) | ||
tween2.start(0) | ||
tween3.start(0) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.x, | ||
b: 0, | ||
failMessage: 'ID: ObjX_24U' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[0], | ||
b: 50, | ||
failMessage: 'ID: ObjY_25C' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[1], | ||
b: 'String test 100', | ||
failMessage: 'ID: ObjY_26G' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj2.x, | ||
b: 0, | ||
failMessage: 'ID: ObjX_26Z' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: arr1[0][0], | ||
b: 100, | ||
failMessage: 'ID: ObjA_27L' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: arr1[1].f, | ||
b: 200, | ||
failMessage: 'ID: ObjF_27X' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.x, | ||
b: 0, | ||
failMessage: 'ID: ObjX_24U' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[0], | ||
b: 50, | ||
failMessage: 'ID: ObjY_25C' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[1], | ||
b: 'String test 100', | ||
failMessage: 'ID: ObjY_26G' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj2.x, | ||
b: 0, | ||
failMessage: 'ID: ObjX_26Z' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: arr1[0][0], | ||
b: 100, | ||
failMessage: 'ID: ObjA_27L' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: arr1[1].f, | ||
b: 200, | ||
failMessage: 'ID: ObjF_27X' | ||
}) | ||
TWEEN.update(1000) | ||
TWEEN.update(1000) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.x, | ||
b: 100, | ||
failMessage: 'There something wrong with number interpolation', | ||
successMessage: 'Number interpolation works as excepted' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[0], | ||
b: 75, | ||
failMessage: 'There something wrong with Array number interpolation', | ||
successMessage: 'Array Number interpolation works as excepted' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[1], | ||
b: 'String test 150', | ||
failMessage: 'There something wrong with Array string interpolation', | ||
successMessage: 'Array string interpolation works as excepted' | ||
}) | ||
tests.push({ | ||
method: 'not', | ||
a: obj2.x, | ||
b: 50, | ||
failMessage: 'Easing not works properly or tween instance not handles easing function properly', | ||
successMessage: 'Easing function works properly' | ||
}) | ||
tests.push({ | ||
method: 'deepEqual', | ||
a: deepArrayCopy(arr1), | ||
b: [ [ 50 ], { f: 150 } ], | ||
failMessage: 'Array-based tween failed due of internal processor/instance and/or something failed within core', | ||
successMessage: 'Array-based tweens works properly' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.x, | ||
b: 100, | ||
failMessage: 'There something wrong with number interpolation', | ||
successMessage: 'Number interpolation works as excepted' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[0], | ||
b: 75, | ||
failMessage: 'There something wrong with Array number interpolation', | ||
successMessage: 'Array Number interpolation works as excepted' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[1], | ||
b: 'String test 150', | ||
failMessage: 'There something wrong with Array string interpolation', | ||
successMessage: 'Array string interpolation works as excepted' | ||
}) | ||
tests.push({ | ||
method: 'not', | ||
a: obj2.x, | ||
b: 50, | ||
failMessage: 'Easing not works properly or tween instance not handles easing function properly', | ||
successMessage: 'Easing function works properly' | ||
}) | ||
tests.push({ | ||
method: 'deepEqual', | ||
a: deepArrayCopy(arr1), | ||
b: [[50], { f: 150 }], | ||
failMessage: 'Array-based tween failed due of internal processor/instance and/or something failed within core', | ||
successMessage: 'Array-based tweens works properly' | ||
}) | ||
TWEEN.update(2000) | ||
TWEEN.update(2000) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.x, | ||
b: 200, | ||
failMessage: 'ID: ObjX_32R' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[0], | ||
b: 100, | ||
failMessage: 'ID: ObjY_33V' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[1], | ||
b: 'String test 200', | ||
failMessage: 'ID: ObjY_33S' | ||
}) | ||
tests.push({ | ||
method: 'not', | ||
a: obj2.x, | ||
b: 200, | ||
failMessage: 'ID: ObjY_34I' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: arr1[0][0], | ||
b: 0, | ||
failMessage: 'ID: ObjA_34P' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: arr1[1].f, | ||
b: 100, | ||
failMessage: 'ID: ObjF_35T' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.x, | ||
b: 200, | ||
failMessage: 'ID: ObjX_32R' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[0], | ||
b: 100, | ||
failMessage: 'ID: ObjY_33V' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj.y[1], | ||
b: 'String test 200', | ||
failMessage: 'ID: ObjY_33S' | ||
}) | ||
tests.push({ | ||
method: 'not', | ||
a: obj2.x, | ||
b: 200, | ||
failMessage: 'ID: ObjY_34I' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: arr1[0][0], | ||
b: 0, | ||
failMessage: 'ID: ObjA_34P' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: arr1[1].f, | ||
b: 100, | ||
failMessage: 'ID: ObjF_35T' | ||
}) | ||
TWEEN.update(4000) | ||
TWEEN.update(4000) | ||
tests.push({ | ||
method: 'is', | ||
a: obj2.x, | ||
b: 200, | ||
failMessage: 'ID: ObjY_36K' | ||
}) | ||
tests.push({ | ||
method: 'is', | ||
a: obj2.x, | ||
b: 200, | ||
failMessage: 'ID: ObjY_36K' | ||
}) | ||
return tests | ||
}).then(tests => { | ||
tests.map(({ method, a, b, failMessage, successMessage }) => { | ||
if (method === 'log') { | ||
t.log(successMessage) | ||
} else { | ||
t[method](a, b, failMessage) | ||
successMessage && t.log(successMessage) | ||
} | ||
return tests | ||
}) | ||
}) | ||
.then((tests) => { | ||
tests.map(({ method, a, b, failMessage, successMessage }) => { | ||
if (method === 'log') { | ||
t.log(successMessage) | ||
} else { | ||
t[method](a, b, failMessage) | ||
successMessage && t.log(successMessage) | ||
} | ||
}) | ||
}) | ||
}) | ||
@@ -417,0 +418,0 @@ |
@@ -8,12 +8,15 @@ import puppeteer from 'puppeteer' | ||
let _browser | ||
return puppeteer.launch({ headless: true, args: ['--no-sandbox'] }).then(browser => { | ||
_browser = browser | ||
return browser.newPage().then(page => { | ||
return page.evaluate( | ||
fs.readFileSync(path.join(__dirname, 'bundled/Tween.js'), 'utf8') | ||
).then(() => page) | ||
}).then((page) => { | ||
return run(t, page).then(() => page) | ||
return puppeteer | ||
.launch({ headless: true, args: ['--no-sandbox'] }) | ||
.then((browser) => { | ||
_browser = browser | ||
return browser | ||
.newPage() | ||
.then((page) => { | ||
return page.evaluate(fs.readFileSync(path.join(__dirname, 'bundled/Tween.js'), 'utf8')).then(() => page) | ||
}) | ||
.then((page) => { | ||
return run(t, page).then(() => page) | ||
}) | ||
}) | ||
}) | ||
.then((page) => { | ||
@@ -20,0 +23,0 @@ _browser.close() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
17
367230
29
4877