Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es6-tween

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-tween - npm Package Compare versions

Comparing version 2.6.0 to 3.0.1

plugins/attr.js

0

CHANGELOG.md

@@ -0,0 +0,0 @@ # CHANGELOG

451

dist/Tween.js

@@ -7,84 +7,4 @@ (function (global, factory) {

var bind = function (fn, ctx) {
return function () {
return fn.apply(ctx, arguments)
}
};
/* global global, window, Object, document, process, requestAnimationFrame, cancelAnimationFrame, setTimeout, clearTimeout */
var EventClass = function EventClass () {
this._events = {};
this._bind = this;
this.on = bind(this.on, this);
this.once = bind(this.once, this);
this.off = bind(this.off, this);
this.emit = bind(this.emit, this);
};
EventClass.prototype.bind = function bind (scope) {
this._bind = scope;
return this
};
EventClass.prototype.on = function on (event, callback) {
if (!this._events[event]) {
this._events[event] = [];
}
this._events[event].push(callback);
return this
};
EventClass.prototype.once = function once (event, callback) {
if (!this._events[event]) {
this._events[event] = [];
}
var ref = this;
var _events = ref._events;
var _bind = ref._bind;
var spliceIndex = _events[event].length;
this._events[event].push(function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
callback.apply(_bind, args);
_events[event].splice(spliceIndex, 1);
});
return this
};
EventClass.prototype.off = function off (event, callback) {
var ref = this;
var _events = ref._events;
if (event === undefined || !_events[event]) {
return this
}
if (callback) {
this._events[event] = this._events[event].filter(function (cb) { return cb !== callback; });
} else {
this._events[event].length = 0;
}
return this
};
EventClass.prototype.emit = function emit (event, arg1, arg2, arg3, arg4) {
var ref = this;
var _events = ref._events;
var _bind = ref._bind;
if (event === undefined || !_events[event]) {
return this
}
var _event = _events[event];
for (var i = 0, length = _event.length; i < length; i++) {
_event[i].call(_bind, arg1, arg2, arg3, arg4);
}
};
/* global global, window, Object, document, process, requestAnimationFrame, cancelAnimationFrame, setTimeout, clearTimeout */
var _tweens = {};

@@ -94,7 +14,2 @@ var isStarted = false;

var _tick;
var ref = new EventClass();
var emit = ref.emit;
var on = ref.on;
var once = ref.once;
var off = ref.off;
var root = typeof (window) !== 'undefined' ? window : typeof (global) !== 'undefined' ? global : {};

@@ -117,6 +32,3 @@ var _nextId = 0;

isStarted = true;
emit('start');
}
emit('add', tween, _tweens);
};

@@ -199,8 +111,5 @@

emit('update', time, _tweens);
if (_tweens.length === 0) {
isStarted = false;
_stopTicker(_tick);
emit('stop', time);
return false

@@ -221,2 +130,4 @@ }

var Plugins = {};
// Normalise time when visiblity is changed (if available) ...

@@ -639,6 +550,10 @@ if (root.document) {

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

@@ -697,3 +612,3 @@ if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {

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

@@ -713,4 +628,2 @@ var _endMap = trim(end).replace(hexColor, hexReplace).match(numRegExp).map(toNumber);

}
} else if (typeof end === 'function') {
return end
} else if (!Array.isArray(start) && Array.isArray(end)) {

@@ -721,4 +634,3 @@ end.unshift(start);

} else {
var isSame$1 = start === end;
return function (t) { return isSame$1 ? start : t >= 0.5 ? end : start; }
return end
}

@@ -738,2 +650,72 @@ };

var EventClass = function EventClass () {
this._events = {};
};
EventClass.prototype.bind = function bind (scope) {
this._bind = scope;
return this
};
EventClass.prototype.on = function on (event, callback) {
if (!this._events[event]) {
this._events[event] = [];
}
this._events[event].push(callback);
return this
};
EventClass.prototype.once = function once (event, callback) {
if (!this._events[event]) {
this._events[event] = [];
}
var ref = this;
var _events = ref._events;
var _bind = ref._bind;
var spliceIndex = _events[event].length;
this._events[event].push(function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
callback.apply(_bind, args);
_events[event].splice(spliceIndex, 1);
});
return this
};
EventClass.prototype.off = function off (event, callback) {
var ref = this;
var _events = ref._events;
if (event === undefined || !_events[event]) {
return this
}
if (callback) {
this._events[event] = this._events[event].filter(function (cb) { return cb !== callback; });
} else {
this._events[event].length = 0;
}
return this
};
EventClass.prototype.emit = function emit (event, arg1, arg2, arg3, arg4) {
var ref = this;
var _events = ref._events;
var _bind = ref._bind;
if (event === undefined || !_events[event]) {
return this
}
var _event = _events[event];
for (var i = 0, length = _event.length; i < length; i++) {
_event[i].call(_bind, arg1, arg2, arg3, arg4);
}
};
var defaultEasing = Easing.Linear.None;

@@ -759,3 +741,6 @@

this.isJoinToString = typeof object === 'string';
if (object.node) {
this.node = object.node;
delete object.node;
}
this.object = object;

@@ -780,2 +765,3 @@ this._valuesStart = Tween.createEmptyConst(object);

this.id = nextId();
this._plugins = {};

@@ -917,2 +903,7 @@ if (instate && instate.to) {

for (var property in _valuesEnd) {
var isPluginProp = Plugins[property];
if (isPluginProp) {
isPluginProp = this$1._plugins[property] = new Plugins[property](this$1, object[property], _valuesEnd[property]);
isPluginProp.preprocess && isPluginProp.preprocess(object[property], _valuesEnd[property]);
}
if (typeof _valuesEnd[property] === 'object' && _valuesEnd[property]) {

@@ -943,2 +934,6 @@ this$1._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);

this$1._valuesStart[property] = object[property];
if (isPluginProp) {
isPluginProp.postprocess && isPluginProp.postprocess(this$1.object[property], this$1._valuesEnd[property]);
}
}

@@ -1053,2 +1048,3 @@

var _valuesEnd = ref._valuesEnd;
var _plugins = ref._plugins;
var object = ref.object;

@@ -1092,5 +1088,8 @@

var end = _valuesEnd[property];
var plugin = _plugins[property];
value = _easingFunction[property] ? _easingFunction[property](elapsed) : value;
if (typeof end === 'function') {
if (plugin) {
plugin.update(value, elapsed, _reversed);
} else if (typeof end === 'function') {
object[property] = end(value);

@@ -1161,243 +1160,2 @@ } else if (Array.isArray(end)) {

var cache = {
filter: {
grayscale: 1,
brightness: 1,
sepia: 1,
invert: 1,
saturate: 1,
contrast: 1,
blur: 1,
hueRotate: 1,
dropShadow: 1
},
transform: {
translate: 1,
translateX: 1,
translateY: 1,
translateZ: 1,
rotate: 1,
rotateX: 1,
rotateY: 1,
rotateZ: 1,
scale: 1,
scaleX: 1,
scaleY: 1,
scaleZ: 1,
skew: 1,
skewX: 1,
skewY: 1,
x: 1,
y: 1,
z: 1
},
scroll: {
scrollTop: 1,
scrollLeft: 1
}
};
var Plugins = function Plugins () {};
Plugins.Attr = function Attr () {
var layer = this.domNode;
return {
update: function update (RenderObject) {
for (var p in RenderObject) {
if (cache.transform[p] || cache.filter[p] || cache.scroll[p]) { continue }
layer.setAttribute(p, RenderObject[p]);
}
}
}
};
Plugins.Style = function Style () {
var layer = this.domNode;
var style = layer.style;
return {
update: function update (RenderObject) {
for (var p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) { continue }
style[p] = RenderObject[p];
}
}
}
};
Plugins.Transform = function Transform () {
var layer = this.domNode;
var style = layer.style;
return {
update: function update (RenderObject) {
var transform = '';
for (var p in RenderObject) {
if (!cache.transform[p]) { continue }
if (p === 'x' || p === 'y' || p === 'z') {
transform += ' translate3d( ' + (RenderObject.x || '0px') + ', ' + (RenderObject.y || '0px') + ', ' + (RenderObject.z || '0px') + ')';
} else if (cache.transform[p]) {
transform += " " + p + "( " + (RenderObject[p]) + ")";
}
}
if (transform) {
style.transform = transform;
}
}
}
};
Plugins.SVGTransform = function SVGTransform (xPos, yPos) {
var layer = this.domNode;
var bbox = {};
var self = null;
var attrName = 'transform';
var rotate = 'rotate';
var x = 'x';
var y = 'y';
return (self = {
update: function update (RenderObject) {
var transform = '';
for (var p in RenderObject) {
if (!cache[attrName][p]) { continue }
if (bbox.x === undefined || bbox.y === undefined) {
self.setOrigin(xPos, yPos);
continue
}
if (p === rotate) {
transform += " rotate(" + (RenderObject[p]) + " " + (bbox.x) + " " + (bbox.y) + ")";
} else if (p === x || p === y) {
transform += " translate(" + (RenderObject.x || 0) + ", " + (RenderObject.y || 0) + ")";
} else {
transform += " " + p + "(" + (RenderObject[p]) + ")";
}
}
if (transform) {
layer.setAttribute(attrName, transform);
}
return self
},
init: function init () {
return self.setOrigin(xPos, yPos)
},
setOrigin: function setOrigin (x, y) {
var ref = layer.getBoundingClientRect();
var width = ref.width;
var height = ref.height;
var left = ref.left;
var top = ref.top;
x = typeof (x) === 'number' ? left + x : typeof x === 'string' && x.indexOf('%') > -1 ? left + (width * (parseFloat(x) / 100)) : left + (width / 2);
y = typeof (y) === 'number' ? left + y : typeof y === 'string' && y.indexOf('%') > -1 ? top + (height * (parseFloat(y) / 100)) : top + (height / 2);
if (bbox.x !== undefined && bbox.y !== undefined) {
var diffX = bbox.x - x;
var diffY = bbox.y - y;
x += x - diffX;
y += y - diffY;
}
bbox.x = x;
bbox.y = y;
return self
}
})
};
Plugins.Filter = function Filter () {
var layer = this.domNode;
var style = layer.style;
return {
update: function update (RenderObject) {
var filter = '';
for (var p in RenderObject) {
if (!cache.filter[p]) { continue }
if (cache.filter[p]) {
filter += " " + p + "( " + (RenderObject[p]) + ")";
}
}
if (filter) {
style.webkitFilter = style.filter = filter;
}
}
}
};
Plugins.Scroll = function Scroll () {
var layer = this.domNode;
return {
update: function (RenderObject) {
for (var p in RenderObject) {
if (!cache.scroll[p]) { continue }
layer[p] = RenderObject[p];
}
}
}
};
var Composite = function Composite (domNode) {
this.domNode = domNode;
this.plugins = {};
this.map = this.map.bind(this);
this.render = this.render.bind(this);
this.init = this.init.bind(this);
this.fetch = this.fetch.bind(this);
return this
};
Composite.prototype.map = function map (type) {
var this$1 = this;
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
var ref = this;
var plugins = ref.plugins;
for (var p in plugins) {
var plugin = plugins[p];
plugin && plugin[type] && plugin[type].apply(this$1, args);
}
return this
};
Composite.prototype.render = function render (object, value, elapsed) {
return this.map('update', object, value, elapsed)
};
Composite.prototype.init = function init (object) {
return this.map('init', object)
};
Composite.prototype.fetch = function fetch (object) {
return this.map('fetch', object)
};
Composite.prototype.applyPlugin = function applyPlugin (name) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
if (Plugins[name] !== undefined) {
this.plugins[name] = Plugins[name].apply(this, args);
return this.plugins[name]
}
return this
};
Composite.prototype.appendTo = function appendTo (node) {
node.appendChild(this.domNode);
return this
};
var Timeline = (function (Tween$$1) {

@@ -1602,3 +1360,5 @@ function Timeline (params) {

exports.Plugins = Plugins;
exports.TweenInit = TweenInit;
exports.Interpolator = SubTween;
exports.nextId = nextId;

@@ -1614,13 +1374,6 @@ exports.has = has;

exports.autoPlay = autoPlay;
exports.on = on;
exports.once = once;
exports.off = off;
exports.emit = emit;
exports.Tween = Tween;
exports.Easing = Easing;
exports.Interpolation = Interpolation;
exports.Composite = Composite;
exports.Timeline = Timeline;
exports.Plugins = Plugins;
exports.PropertyTypes = cache;

@@ -1627,0 +1380,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.TWEEN=t.TWEEN||{})}(this,function(t){"use strict";function e(t){var e=parseFloat(t);return"number"!=typeof e||isNaN(e)?t:e}var n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(){this._events={},this._bind=this,this.on=n(this.on,this),this.once=n(this.once,this),this.off=n(this.off,this),this.emit=n(this.emit,this)};r.prototype.bind=function(t){return this._bind=t,this},r.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e),this},r.prototype.once=function(t,e){this._events[t]||(this._events[t]=[]);var n=this,r=n._events,i=n._bind,o=r[t].length;return this._events[t].push(function(){for(var n=[],s=arguments.length;s--;)n[s]=arguments[s];e.apply(i,n),r[t].splice(o,1)}),this},r.prototype.off=function(t,e){var n=this._events;return void 0!==t&&n[t]?(e?this._events[t]=this._events[t].filter(function(t){return t!==e}):this._events[t].length=0,this):this},r.prototype.emit=function(t,e,n,r,i){var o=this,s=o._events,a=o._bind;if(void 0===t||!s[t])return this;for(var u=s[t],f=0,p=u.length;f<p;f++)u[f].call(a,e,n,r,i)};var i,o={},s=!1,a=!1,u=new r,f=u.emit,p=u.on,h=u.once,c=u.off,l="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d=0,y=function(t){return"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(t):setTimeout(t,16.6)},v=function(t){return"undefined"!=typeof cancelAnimationFrame?cancelAnimationFrame(t):clearTimeout(t)};!function(t,e,n){Object.defineProperty(t,e,n)}(o,"length",{enumerable:!1,writable:!0,value:0});var _=function(t){var e=t.id;o[e]=t,o.length++,a&&!s&&(I(),s=!0,f("start")),f("add",t,o)},m=function(){var t=d;return d++,t},g=function(t){for(var e in o)if(t.id===+e)return o[+e];return null},b=function(t){for(var e in o)t.id===+e&&(delete o[+e],o.length--)},T=function(){if("undefined"!=typeof process&&void 0!==process.hrtime)return function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6};if(void 0!==l.performance&&void 0!==l.performance.now)return l.performance.now.bind(l.performance);var t=l.performance&&l.performance.timing&&l.performance.timing.navigationStart?l.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}(),I=function(t,e){if(t=void 0!==t?t:T(),a&&(i=y(I)),f("update",t,o),0===o.length)return s=!1,v(i),f("stop",t),!1;for(var n in o)o[n].update(t)||e?n++:(delete o[+n],o.length--);return!0};if(l.document){var M=0,O=0;l.document.addEventListener("visibilitychange",function(){if(0===o.length)return!1;if(document.hidden)O=T();else{M=T()-O;for(var t in o)o[t]._startTime+=M}return!0})}var w={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-w.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*w.Bounce.In(2*t):.5*w.Bounce.Out(2*t-1)+.5}}},P={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=P.Utils.Linear;return e<0?o(t[0],t[1],r):e>1?o(t[n],t[n-1],n-r):o(t[i],t[i+1>n?n:i+1],r-i)},Bezier:function(t,e){for(var n=0,r=t.length-1,i=Math.pow,o=P.Utils.Bernstein,s=0;s<=r;s++)n+=i(1-e,r-s)*i(e,s)*t[s]*o(r,s);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=P.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(r=n*(1+e))),o(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],r-i)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):o(t[i?i-1:0],t[i],t[n<i+1?n:i+1],t[n<i+2?n:i+2],r-i)},Utils:{Linear:function(t,e,n){return"function"==typeof e?e(n):(e-t)*n+t},Bernstein:function(t,e){var n=P.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:function(){var t=[1];return function(e){var n=1;if(t[e])return t[e];for(var r=e;r>1;r--)n*=r;return t[e]=n,n}}(),CatmullRom:function(t,e,n,r,i){var o=.5*(n-t),s=.5*(r-e),a=i*i;return(2*e-2*n+o+s)*(i*a)+(-3*e+3*n-2*o-s)*a+o*i+e}}},j=/rgb|hsl|hsv/g,F=/ahsv|ahsl|argb/g,x=/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,A=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,E=/\n|\r|\t/g,S=function(t,e){var n,r,i;return 3===e.length?(n=parseInt(e[0]+e[0],16),r=parseInt(e[1]+e[1],16),i=parseInt(e[2]+e[2],16)):6===e.length&&(n=parseInt(e.substr(0,2),16),r=parseInt(e.substr(2,2),16),i=parseInt(e.substr(4,6),16)),"rgb("+n+","+r+","+i+")"},k=function(t){return"string"==typeof t?t.replace(E,""):t},D=function(t,n,r){if(void 0===r&&(r=1e4),Array.isArray(t)){var i=null,o=null;n=n.map(function(e,n){return j.test(e)?(i=e,o=n,null):e===t[n]?null:"number"==typeof e?e-t[n]:x.test(e)?D(k(t[n]),k(e)):e});var s=null!==o?o+6:null;i&&F.test(i)&&(o++,s++);var a=[].concat(t);return function(e){for(var i=0,u=void 0,f=n.length;i<f;i++)"function"==typeof(u=n[i])?a[i]=u(e):"number"==typeof u&&(a[i]=((t[i]+u*e)*r|0)/r,null!==o&&i>o&&i<s&&(a[i]=0|a[i]));return a}}if("object"==typeof t){for(var u in n)n[u]===t[u]?n[u]=null:"number"==typeof t[u]?n[u]-=t[u]:("object"==typeof n[u]||"string"==typeof n[u]&&x.test(n[u]))&&(n[u]=D(t[u],n[u]));var f=Object.assign({},t);return function(e){for(var i in n){var o=n[i];"function"==typeof o?f[i]=o(e):"number"==typeof o&&(f[i]=((t[i]+o*e)*r|0)/r)}return f}}if("number"==typeof t){var p=t===(n-=t);return function(e){return p?n:((t+n*e)*r|0)/r}}if("string"==typeof t&&"string"==typeof n&&x.test(t)&&x.test(n)||"string"==typeof n&&(A.test(t)||A.test(n))){var h=k(t).replace(A,S).match(x).map(e),c=k(n).replace(A,S).match(x).map(e),l=D(h,c);return function(t){for(var e=l(t),n=0,r="";n<e.length;)r+=e[n],n++;return r}}if("function"==typeof n)return n;if(!Array.isArray(t)&&Array.isArray(n))return n.unshift(t),n.push(n[n.length-1]),n.map(function(e,r){return D(0===r?t:n[r-1],e)});var d=t===n;return function(e){return d?t:e>=.5?n:t}},N={add:function(t){return N[t]&&JSON.stringify(t)&&JSON.stringify(N[t])?N[t]:(N[t]=t,t)}},C=w.Linear.None,B=function(t){function e(n,r){return void 0===n&&(n={}),t.call(this),this.isJoinToString="string"==typeof n,this.object=n,this._valuesStart=e.createEmptyConst(n),this._valuesEnd=e.createEmptyConst(n),this._duration=1e3,this._easingFunction=C,this._interpolationFunction=P.Linear,this._startTime=0,this._delayTime=0,this._repeat=0,this._r=0,this._isPlaying=!1,this._yoyo=!1,this._reversed=!1,this._onStartCallbackFired=!1,this._pausedTime=null,this.id=m(),r&&r.to?new e(n).to(r.to,r):this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.createEmptyConst=function(t){return"number"==typeof t?0:Array.isArray(t)?[]:"object"==typeof t?{}:""},e.checkValidness=function(t){return void 0!==t&&null!==t&&""!==t&&("number"==typeof t&&!isNaN(t)||"number"!=typeof t)&&t!==1/0},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isStarted=function(){return this._onStartCallbackFired},e.prototype.reverse=function(){var t=this._reversed;return this._reversed=!t,this},e.prototype.reversed=function(){return this._reversed},e.prototype.useActiveMode=function(){return this.object=N.add(this.object),this},e.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,b(this),this._pausedTime=T(),this.emit("pause",this.object)):this},e.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=T()-this._pausedTime,_(this),this._pausedTime=T(),this.emit("play",this.object))},e.prototype.restart=function(t){return this._repeat=this._r,this._startTime=T()+(t?0:this._delayTime),this._isPlaying||_(this),this.emit("restart",this._object)},e.prototype.seek=function(t,e){return this._startTime=T()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this._object),e?this:this.pause()},e.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},e.prototype.to=function(t,e){var n=this;if(void 0===t&&(t={}),void 0===e&&(e=1e3),"object"==typeof t&&(this._valuesEnd=t),"number"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var r in e)n[r]&&(i=n)[r].apply(i,Array.isArray(e)?e:[e]);return this;var i},e.prototype.render=function(){var t=this;if(this._rendered)return this;var n=this,r=n._valuesEnd,i=n.object;for(var o in r)"object"==typeof r[o]&&r[o]?(t._valuesEnd[o]=D(i[o],r[o]),"function"==typeof t._valuesEnd[o]&&(t.object[o]=t._valuesEnd[o](0))):"string"==typeof r[o]&&"string"==typeof i[o]&&(t._valuesEnd[o]=D(i[o],r[o]),"function"==typeof t._valuesEnd[o]&&(t.object[o]=t._valuesEnd[o](0))),!1!==e.checkValidness(i[o])&&i[o]!==r[o]&&(t._valuesStart[o]=i[o]);return this},e.prototype.start=function(t){return this._startTime=void 0!==t?t:T(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,_(this),this.emit("start",this.object),this._isPlaying=!0,this},e.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object;return e?(b(this),this._isPlaying=!1,this.emit("stop",n)):this},e.prototype.end=function(){var t=this,e=t._startTime,n=t._duration;return this.update(e+n)},e.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this._startTime+=this._delayTime,this},e.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime="function"==typeof t?t(this._repeatDelayTime):t,this},e.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},e.prototype.yoyo=function(t){return this._yoyo="function"==typeof t?t(this._yoyo):t,this},e.prototype.easing=function(t){return this._easingFunction=t,this},e.prototype.interpolation=function(t){return this._interpolationFunction=t,this},e.prototype.get=function(t){return this.update(t),this.object},e.prototype.update=function(t){var e,n,r,i=this,o=this,s=o._onStartCallbackFired,a=o._easingFunction,u=o._interpolationFunction,f=o._repeat,p=o._repeatDelayTime,h=o._reverseDelayTime,c=o._yoyo,l=o._reversed,d=o._startTime,y=o._duration,v=o._valuesStart,_=o._valuesEnd,m=o.object;if((t=void 0!==t?t:T())<d)return!0;s||(this._rendered||(this.render(),this.emit("start",m),this._rendered=!0),this._onStartCallbackFired=!0),n=(n=(t-d)/y)>1?1:n,n=l?1-n:n,r="function"==typeof a?a(n):C(n);for(e in _)if(void 0!==v[e]){var g=v[e],b=_[e];r=a[e]?a[e](n):r,"function"==typeof b?m[e]=b(r):Array.isArray(b)?m[e]=u(b,r):"string"==typeof b?"number"==typeof(b="+"===b.charAt(0)||"-"===b.charAt(0)?g+parseFloat(b):parseFloat(b))&&(m[e]=g+(b-g)*r):"number"==typeof g&&(m[e]=g+(b-g)*r)}if(this.emit("update",m,r,n),this.object=m,1===n||l&&0===n){if(f){isFinite(f)&&this._repeat--;for(e in _)"string"==typeof _[e]&&"number"==typeof v[e]&&(i._valuesStart[e]=v[e]+parseFloat(_[e]));return this.emit(l?"reverse":"repeat",m),c&&(this._reversed=!l),this._startTime+=!l&&p?y+p:l&&h?y+h:y,!0}return this.emit("complete",m),this._repeat=this._r,!1}return!0},e}(r),L={filter:{grayscale:1,brightness:1,sepia:1,invert:1,saturate:1,contrast:1,blur:1,hueRotate:1,dropShadow:1},transform:{translate:1,translateX:1,translateY:1,translateZ:1,rotate:1,rotateX:1,rotateY:1,rotateZ:1,scale:1,scaleX:1,scaleY:1,scaleZ:1,skew:1,skewX:1,skewY:1,x:1,y:1,z:1},scroll:{scrollTop:1,scrollLeft:1}},q=function(){};q.Attr=function(){var t=this.domNode;return{update:function(e){for(var n in e)L.transform[n]||L.filter[n]||L.scroll[n]||t.setAttribute(n,e[n])}}},q.Style=function(){var t=this.domNode.style;return{update:function(e){for(var n in e)L.transform[n]||L.filter[n]||(t[n]=e[n])}}},q.Transform=function(){var t=this.domNode.style;return{update:function(e){var n="";for(var r in e)L.transform[r]&&("x"===r||"y"===r||"z"===r?n+=" translate3d( "+(e.x||"0px")+", "+(e.y||"0px")+", "+(e.z||"0px")+")":L.transform[r]&&(n+=" "+r+"( "+e[r]+")"));n&&(t.transform=n)}}},q.SVGTransform=function(t,e){var n=this.domNode,r={},i=null;return i={update:function(o){var s="";for(var a in o)L.transform[a]&&(void 0!==r.x&&void 0!==r.y?s+="rotate"===a?" rotate("+o[a]+" "+r.x+" "+r.y+")":"x"===a||"y"===a?" translate("+(o.x||0)+", "+(o.y||0)+")":" "+a+"("+o[a]+")":i.setOrigin(t,e));return s&&n.setAttribute("transform",s),i},init:function(){return i.setOrigin(t,e)},setOrigin:function(t,e){var o=n.getBoundingClientRect(),s=o.width,a=o.height,u=o.left,f=o.top;return t="number"==typeof t?u+t:"string"==typeof t&&t.indexOf("%")>-1?u+s*(parseFloat(t)/100):u+s/2,e="number"==typeof e?u+e:"string"==typeof e&&e.indexOf("%")>-1?f+a*(parseFloat(e)/100):f+a/2,void 0!==r.x&&void 0!==r.y&&(t+=t-(r.x-t),e+=e-(r.y-e)),r.x=t,r.y=e,i}}},q.Filter=function(){var t=this.domNode.style;return{update:function(e){var n="";for(var r in e)L.filter[r]&&L.filter[r]&&(n+=" "+r+"( "+e[r]+")");n&&(t.webkitFilter=t.filter=n)}}},q.Scroll=function(){var t=this.domNode;return{update:function(e){for(var n in e)L.scroll[n]&&(t[n]=e[n])}}};var z=function(t){return this.domNode=t,this.plugins={},this.map=this.map.bind(this),this.render=this.render.bind(this),this.init=this.init.bind(this),this.fetch=this.fetch.bind(this),this};z.prototype.map=function(t){for(var e=this,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];var i=this.plugins;for(var o in i){var s=i[o];s&&s[t]&&s[t].apply(e,n)}return this},z.prototype.render=function(t,e,n){return this.map("update",t,e,n)},z.prototype.init=function(t){return this.map("init",t)},z.prototype.fetch=function(t){return this.map("fetch",t)},z.prototype.applyPlugin=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return void 0!==q[t]?(this.plugins[t]=q[t].apply(this,e),this.plugins[t]):this},z.prototype.appendTo=function(t){return t.appendChild(this.domNode),this};var R=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=T(),this._tweens={},this._elapsed=0,this._id=m(),this._labels={},this._defaultParams=e,this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setLabel=function(t,e){return this._labels[t]=this.parsePosition(0,e,0),this},e.prototype.parsePosition=function(t,e,n){var r=this,i=t+n;if("string"==typeof e){for(var o in r._labels)if(0===e.indexOf(o)){var s=e.split(o)[1];0!==s.length&&"+"!==s[0]&&"-"!==s[0]||(i=r._labels[o]+t,e=e.replace(o,""))}0!==e.indexOf("+")&&0!==e.indexOf("-")||(i+=parseFloat(e))}else"number"==typeof e&&(i+=e);return i},e.prototype.map=function(t){var e=this;for(var n in e._tweens)t(e._tweens[n]);return this},e.prototype.add=function(e,n){"object"!=typeof e||e instanceof t||(e=new t(e.from,e));var r=this,i=r._defaultParams,o=r._totalDuration;if(i)for(var s in i)e[s](i[s]);return e._startTime=this.parsePosition(0,n,o),e._startTime+=T(),this._totalDuration=Math.max(o,e._duration+e._startTime),this._tweens[e.id]=e,this},e.prototype.restart=function(){return this._startTime+=T(),_(this),this.emit("restart")},e.prototype.easing=function(t){return this.map(function(e){return e.easing(t)})},e.prototype.interpolation=function(t){return this.map(function(e){return e.interpolation(t)})},e.prototype.update=function(t){var e=this,n=e._tweens,r=e._totalDuration,i=e._repeatDelayTime,o=e._reverseDelayTime,s=e._startTime,a=e._reversed,u=e._yoyo,f=e._repeat;if(t<s)return!0;var p=Math.min(1,Math.max(0,(t-s)/r));p=a?1-p:p,this._elapsed=p;var h=t-s,c=a?r-h:h;for(var l in n){var d=n[l];d.skip||d.update(c)||(d.skip=!0)}if(this.emit("update",p,h),1===p||a&&0===p){if(f){isFinite(f)&&this._repeat--,this.emit(a?"reverse":"repeat"),u&&(this._reversed=!a),this._startTime+=!a&&i?r+i:a&&o?r+o:r;for(var y in n){var v=n[y];v.skip&&(v.skip=!1)}return!0}return this.emit("complete"),this._repeat=this._r,!1}return!0},e.prototype.elapsed=function(t){return void 0!==t?this.update(t*this._totalDuration):this._elapsed},e.prototype.seek=function(t){return this.update(t<1.1?t*this._totalDuration:t)},e}(B),U=function(t){return t};t.TweenInit=function(t){var e=t.from,n=t.to,r=t.duration;void 0===r&&(r=1e3);var i=t.easing;void 0===i&&(i=U);var o=t.events,s=t.instance,a=new B(e,s).to(n,r).easing(i);o&&(a._events=o),t.start=a.start.bind(a)},t.nextId=m,t.has=function(t){return null!==g(t)},t.get=g,t.getAll=function(){return o},t.removeAll=function(){for(var t in o)o[+t]=null,delete o[+t];o.length=0},t.remove=b,t.add=_,t.now=T,t.update=I,t.autoPlay=function(t){a=t},t.on=p,t.once=h,t.off=c,t.emit=f,t.Tween=B,t.Easing=w,t.Interpolation=P,t.Composite=z,t.Timeline=R,t.Plugins=q,t.PropertyTypes=L,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.TWEEN=t.TWEEN||{})}(this,function(t){"use strict";function e(t){var e=parseFloat(t);return"number"!=typeof e||isNaN(e)?t:e}var n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(){this._events={},this._bind=this,this.on=n(this.on,this),this.once=n(this.once,this),this.off=n(this.off,this),this.emit=n(this.emit,this)};r.prototype.bind=function(t){return this._bind=t,this},r.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e),this},r.prototype.once=function(t,e){this._events[t]||(this._events[t]=[]);var n=this,r=n._events,i=n._bind,o=r[t].length;return this._events[t].push(function(){for(var n=[],s=arguments.length;s--;)n[s]=arguments[s];e.apply(i,n),r[t].splice(o,1)}),this},r.prototype.off=function(t,e){var n=this._events;return void 0!==t&&n[t]?(e?this._events[t]=this._events[t].filter(function(t){return t!==e}):this._events[t].length=0,this):this},r.prototype.emit=function(t,e,n,r,i){var o=this,s=o._events,a=o._bind;if(void 0===t||!s[t])return this;for(var u=s[t],f=0,h=u.length;f<h;f++)u[f].call(a,e,n,r,i)};var i,o={},s=!1,a=!1,u=new r,f=u.emit,h=u.on,p=u.once,c=u.off,l="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d=0,y=function(t){return"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(t):setTimeout(t,16.6)},v=function(t){return"undefined"!=typeof cancelAnimationFrame?cancelAnimationFrame(t):clearTimeout(t)};!function(t,e,n){Object.defineProperty(t,e,n)}(o,"length",{enumerable:!1,writable:!0,value:0});var _=function(t){var e=t.id;o[e]=t,o.length++,a&&!s&&(I(),s=!0,f("start")),f("add",t,o)},m=function(){var t=d;return d++,t},g=function(t){for(var e in o)if(t.id===+e)return o[+e];return null},b=function(t){for(var e in o)t.id===+e&&(delete o[+e],o.length--)},T=function(){if("undefined"!=typeof process&&void 0!==process.hrtime)return function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6};if(void 0!==l.performance&&void 0!==l.performance.now)return l.performance.now.bind(l.performance);var t=l.performance&&l.performance.timing&&l.performance.timing.navigationStart?l.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}(),I=function(t,e){if(t=void 0!==t?t:T(),a&&(i=y(I)),f("update",t,o),0===o.length)return s=!1,v(i),f("stop",t),!1;for(var n in o)o[n].update(t)||e?n++:(delete o[+n],o.length--);return!0};if(l.document){var M=0,O=0;l.document.addEventListener("visibilitychange",function(){if(0===o.length)return!1;if(document.hidden)O=T();else{M=T()-O;for(var t in o)o[t]._startTime+=M}return!0})}var w={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-w.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*w.Bounce.In(2*t):.5*w.Bounce.Out(2*t-1)+.5}}},P={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=P.Utils.Linear;return e<0?o(t[0],t[1],r):e>1?o(t[n],t[n-1],n-r):o(t[i],t[i+1>n?n:i+1],r-i)},Bezier:function(t,e){for(var n=0,r=t.length-1,i=Math.pow,o=P.Utils.Bernstein,s=0;s<=r;s++)n+=i(1-e,r-s)*i(e,s)*t[s]*o(r,s);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=P.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(r=n*(1+e))),o(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],r-i)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):o(t[i?i-1:0],t[i],t[n<i+1?n:i+1],t[n<i+2?n:i+2],r-i)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=P.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:function(){var t=[1];return function(e){var n=1;if(t[e])return t[e];for(var r=e;r>1;r--)n*=r;return t[e]=n,n}}(),CatmullRom:function(t,e,n,r,i){var o=.5*(n-t),s=.5*(r-e),a=i*i;return(2*e-2*n+o+s)*(i*a)+(-3*e+3*n-2*o-s)*a+o*i+e}}},j=/rgb|hsl|hsv/g,F=/ahsv|ahsl|argb/g,x=/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,A=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,E=function(t,e){var n,r,i;return 3===e.length?(n=parseInt(e[0]+e[0],16),r=parseInt(e[1]+e[1],16),i=parseInt(e[2]+e[2],16)):6===e.length&&(n=parseInt(e.substr(0,2),16),r=parseInt(e.substr(2,2),16),i=parseInt(e.substr(4,6),16)),"rgb("+n+","+r+","+i},N=function(t,n,r){if(void 0===r&&(r=1e4),Array.isArray(t)){var i=null,o=null;n=n.map(function(e,n){return j.test(e)?(i=e,o=n,null):e===t[n]?null:"number"==typeof e?e-t[n]:N(t[n],e)});var s=null!==o?o+6:null;i&&F.test(i)&&(o++,s++);var a=[].concat(t);return function(e){for(var i=0,u=void 0,f=n.length;i<f;i++)"function"==typeof(u=n[i])?a[i]=u(e):"number"==typeof u&&(a[i]=((t[i]+u*e)*r|0)/r,null!==o&&i>o&&i<s&&(a[i]=0|a[i]));return a}}if("object"==typeof t){for(var u in n)n[u]===t[u]?n[u]=null:"number"==typeof t[u]?n[u]-=t[u]:"object"!=typeof n[u]&&"string"!=typeof[n]||(n[u]=N(t[u],n[u]));var f=Object.assign({},t);return function(e){for(var i in n){var o=n[i];"function"==typeof o?f[i]=o(e):"number"==typeof o&&(f[i]=((t[i]+o*e)*r|0)/r)}return f}}if("number"==typeof t){var h=t===(n-=t);return function(e){return h?n:((t+n*e)*r|0)/r}}if("string"==typeof t){var p=t.replace(A,E).match(x).map(e),c=n.replace(A,E).match(x).map(e),l=N(p,c);return function(t){for(var e=l(t),n=0,r="";n<e.length;)r+=e[n],n++;return r}}if("function"==typeof n)return n;var d=t===n;return function(e){return d?t:e>=.5?n:t}},S={add:function(t){return S[t]&&JSON.stringify(t)&&JSON.stringify(S[t])?S[t]:(S[t]=t,t)}},k=w.Linear.None,D=function(t){function e(n,r){return void 0===n&&(n={}),t.call(this),this.isJoinToString="string"==typeof n,this.object=n,this._valuesStart=e.createEmptyConst(n),this._valuesEnd=e.createEmptyConst(n),this._duration=1e3,this._easingFunction=k,this._interpolationFunction=P.None,this._startTime=0,this._delayTime=0,this._repeat=0,this._r=0,this._isPlaying=!1,this._yoyo=!1,this._reversed=!1,this._onStartCallbackFired=!1,this._pausedTime=null,this.id=m(),r&&r.to?new e(n).to(r.to,r):this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.createEmptyConst=function(t){return"number"==typeof t?0:Array.isArray(t)?[]:"object"==typeof t?{}:""},e.checkValidness=function(t){return void 0!==t&&null!==t&&""!==t&&("number"==typeof t&&!isNaN(t)||"number"!=typeof t)&&t!==1/0},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isStarted=function(){return this._onStartCallbackFired},e.prototype.reverse=function(){var t=this._reversed;return this._reversed=!t,this},e.prototype.reversed=function(){return this._reversed},e.prototype.useActiveMode=function(){return this.object=S.add(this.object),this},e.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,b(this),this._pausedTime=T(),this.emit("pause",this.object)):this},e.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=T()-this._pausedTime,_(this),this._pausedTime=T(),this.emit("play",this.object))},e.prototype.restart=function(t){return this._repeat=this._r,this._startTime=T()+(t?0:this._delayTime),this._isPlaying||_(this),this.emit("restart",this._object)},e.prototype.seek=function(t,e){return this._startTime=T()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this._object),e?this:this.pause()},e.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},e.prototype.to=function(t,e){var n=this;if(void 0===t&&(t={}),void 0===e&&(e=1e3),"object"==typeof t&&(this._valuesEnd=t),"number"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var r in e)n[r]&&(i=n)[r].apply(i,Array.isArray(e)?e:[e]);return this;var i},e.prototype.render=function(){var t=this;if(this._rendered)return this;var n=this,r=n._valuesEnd,i=n.object;for(var o in r)"object"==typeof r[o]&&r[o]?(t._valuesEnd[o]=N(i[o],r[o]),t.object[o]=t._valuesEnd[o](0)):"string"==typeof r[o]&&"string"==typeof i[o]&&(t._valuesEnd[o]=N(i[o],r[o]),t.object[o]=t._valuesEnd[o](0)),!1!==e.checkValidness(i[o])&&i[o]!==r[o]&&(t._valuesStart[o]=i[o]);return this},e.prototype.start=function(t){return this._startTime=void 0!==t?t:T(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,_(this),this.emit("start",this.object),this._isPlaying=!0,this},e.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object;return e?(b(this),this._isPlaying=!1,this.emit("stop",n)):this},e.prototype.end=function(){var t=this,e=t._startTime,n=t._duration;return this.update(e+n)},e.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this._startTime+=this._delayTime,this},e.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime="function"==typeof t?t(this._repeatDelayTime):t,this},e.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},e.prototype.yoyo=function(t){return this._yoyo="function"==typeof t?t(this._yoyo):t,this},e.prototype.easing=function(t){return this._easingFunction=t,this},e.prototype.interpolation=function(t){return this._interpolationFunction=t,this},e.prototype.get=function(t){return this.update(t),this.object},e.prototype.update=function(t){var e,n,r,i=this,o=this,s=o._onStartCallbackFired,a=o._easingFunction,u=o._interpolationFunction,f=o._repeat,h=o._repeatDelayTime,p=o._reverseDelayTime,c=o._yoyo,l=o._reversed,d=o._startTime,y=o._duration,v=o._valuesStart,_=o._valuesEnd,m=o.object;if((t=void 0!==t?t:T())<d)return!0;s||(this._rendered||(this.render(),this.emit("start",m),this._rendered=!0),this._onStartCallbackFired=!0),n=(n=(t-d)/y)>1?1:n,n=l?1-n:n,r="function"==typeof a?a(n):k(n);for(e in _)if(void 0!==v[e]){var g=v[e],b=_[e];r=a[e]?a[e](n):r,"function"==typeof b?m[e]=b(r):Array.isArray(b)?m[e]=u(b,r):"string"==typeof b?"number"==typeof(b="+"===b.charAt(0)||"-"===b.charAt(0)?g+parseFloat(b):parseFloat(b))&&(m[e]=g+(b-g)*r):"number"==typeof g&&(m[e]=g+(b-g)*r)}if(this.emit("update",m,r,n),this.object=m,1===n||l&&0===n){if(f){isFinite(f)&&this._repeat--;for(e in _)"string"==typeof _[e]&&"number"==typeof v[e]&&(i._valuesStart[e]=v[e]+parseFloat(_[e]));return this.emit(l?"reverse":"repeat",m),c&&(this._reversed=!l),this._startTime+=!l&&h?y+h:l&&p?y+p:y,!0}return this.emit("complete",m),this._repeat=this._r,!1}return!0},e}(r),C={filter:{grayscale:1,brightness:1,sepia:1,invert:1,saturate:1,contrast:1,blur:1,hueRotate:1,dropShadow:1},transform:{translate:1,translateX:1,translateY:1,translateZ:1,rotate:1,rotateX:1,rotateY:1,rotateZ:1,scale:1,scaleX:1,scaleY:1,scaleZ:1,skew:1,skewX:1,skewY:1,x:1,y:1,z:1},scroll:{scrollTop:1,scrollLeft:1}},B=function(){};B.Attr=function(){var t=this.domNode;return{update:function(e){for(var n in e)C.transform[n]||C.filter[n]||C.scroll[n]||t.setAttribute(n,e[n])}}},B.Style=function(){var t=this.domNode.style;return{update:function(e){for(var n in e)C.transform[n]||C.filter[n]||(t[n]=e[n])}}},B.Transform=function(){var t=this.domNode.style;return{update:function(e){var n="";for(var r in e)C.transform[r]&&("x"===r||"y"===r||"z"===r?n+=" translate3d( "+(e.x||"0px")+", "+(e.y||"0px")+", "+(e.z||"0px")+")":C.transform[r]&&(n+=" "+r+"( "+e[r]+")"));n&&(t.transform=n)}}},B.SVGTransform=function(t,e){var n=this.domNode,r={},i=null;return i={update:function(o){var s="";for(var a in o)C.transform[a]&&(void 0!==r.x&&void 0!==r.y?s+="rotate"===a?" rotate("+o[a]+" "+r.x+" "+r.y+")":"x"===a||"y"===a?" translate("+(o.x||0)+", "+(o.y||0)+")":" "+a+"("+o[a]+")":i.setOrigin(t,e));return s&&n.setAttribute("transform",s),i},init:function(){return i.setOrigin(t,e)},setOrigin:function(t,e){var o=n.getBoundingClientRect(),s=o.width,a=o.height,u=o.left,f=o.top;return t="number"==typeof t?u+t:"string"==typeof t&&t.indexOf("%")>-1?u+s*(parseFloat(t)/100):u+s/2,e="number"==typeof e?u+e:"string"==typeof e&&e.indexOf("%")>-1?f+a*(parseFloat(e)/100):f+a/2,void 0!==r.x&&void 0!==r.y&&(t+=t-(r.x-t),e+=e-(r.y-e)),r.x=t,r.y=e,i}}},B.Filter=function(){var t=this.domNode.style;return{update:function(e){var n="";for(var r in e)C.filter[r]&&C.filter[r]&&(n+=" "+r+"( "+e[r]+")");n&&(t.webkitFilter=t.filter=n)}}},B.Scroll=function(){var t=this.domNode;return{update:function(e){for(var n in e)C.scroll[n]&&(t[n]=e[n])}}};var L=function(t){return this.domNode=t,this.plugins={},this.map=this.map.bind(this),this.render=this.render.bind(this),this.init=this.init.bind(this),this.fetch=this.fetch.bind(this),this};L.prototype.map=function(t){for(var e=this,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];var i=this.plugins;for(var o in i){var s=i[o];s&&s[t]&&s[t].apply(e,n)}return this},L.prototype.render=function(t,e,n){return this.map("update",t,e,n)},L.prototype.init=function(t){return this.map("init",t)},L.prototype.fetch=function(t){return this.map("fetch",t)},L.prototype.applyPlugin=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return void 0!==B[t]?(this.plugins[t]=B[t].apply(this,e),this.plugins[t]):this},L.prototype.appendTo=function(t){return t.appendChild(this.domNode),this};var q=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=T(),this._tweens={},this._elapsed=0,this._id=m(),this._labels={},this._defaultParams=e,this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setLabel=function(t,e){return this._labels[t]=this.parsePosition(0,e,0),this},e.prototype.parsePosition=function(t,e,n){var r=this,i=t+n;if("string"==typeof e){for(var o in r._labels)if(0===e.indexOf(o)){var s=e.split(o)[1];0!==s.length&&"+"!==s[0]&&"-"!==s[0]||(i=r._labels[o]+t,e=e.replace(o,""))}0!==e.indexOf("+")&&0!==e.indexOf("-")||(i+=parseFloat(e))}else"number"==typeof e&&(i+=e);return i},e.prototype.map=function(t){var e=this;for(var n in e._tweens)t(e._tweens[n]);return this},e.prototype.add=function(e,n){"object"!=typeof e||e instanceof t||(e=new t(e.from,e));var r=this,i=r._defaultParams,o=r._totalDuration;if(i)for(var s in i)e[s](i[s]);return e._startTime=this.parsePosition(0,n,o),e._startTime+=T(),this._totalDuration=Math.max(o,e._duration+e._startTime),this._tweens[e.id]=e,this},e.prototype.restart=function(){return this._startTime+=T(),_(this),this.emit("restart")},e.prototype.easing=function(t){return this.map(function(e){return e.easing(t)})},e.prototype.interpolation=function(t){return this.map(function(e){return e.interpolation(t)})},e.prototype.update=function(t){var e=this,n=e._tweens,r=e._totalDuration,i=e._repeatDelayTime,o=e._reverseDelayTime,s=e._startTime,a=e._reversed,u=e._yoyo,f=e._repeat;if(t<s)return!0;var h=Math.min(1,Math.max(0,(t-s)/r));h=a?1-h:h,this._elapsed=h;var p=t-s,c=a?r-p:p;for(var l in n){var d=n[l];d.skip||d.update(c)||(d.skip=!0)}if(this.emit("update",h,p),1===h||a&&0===h){if(f){isFinite(f)&&this._repeat--,this.emit(a?"reverse":"repeat"),u&&(this._reversed=!a),this._startTime+=!a&&i?r+i:a&&o?r+o:r;for(var y in n){var v=n[y];v.skip&&(v.skip=!1)}return!0}return this.emit("complete"),this._repeat=this._r,!1}return!0},e.prototype.elapsed=function(t){return void 0!==t?this.update(t*this._totalDuration):this._elapsed},e.prototype.seek=function(t){return this.update(t<1.1?t*this._totalDuration:t)},e}(D),z=function(t){return t};t.TweenInit=function(t){var e=t.from,n=t.to,r=t.duration;void 0===r&&(r=1e3);var i=t.easing;void 0===i&&(i=z);var o=t.events,s=t.instance,a=new D(e,s).to(n,r).easing(i);o&&(a._events=o),t.start=a.start.bind(a)},t.nextId=m,t.has=function(t){return null!==g(t)},t.get=g,t.getAll=function(){return o},t.removeAll=function(){for(var t in o)o[+t]=null,delete o[+t];o.length=0},t.remove=b,t.add=_,t.now=T,t.update=I,t.autoPlay=function(t){a=t},t.on=h,t.once=p,t.off=c,t.emit=f,t.Tween=D,t.Easing=w,t.Interpolation=P,t.Composite=L,t.Timeline=q,t.Plugins=B,t.PropertyTypes=C,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=dist/Tween.min.js.map
//# sourceMappingURL=Tween.min.js.map
{
"name": "es6-tween",
"version": "2.6.0",
"description": "ES6 implementation of amazing tween.js",
"browser": "dist/Tween.min.js",
"cdn": "dist/Tween.min.js",
"main": "dist/Tween.min.js",
"directories": {
"example": "examples"
},
"scripts": {
"source": "rollup -c --environment min:false",
"minify": "rollup -c --environment min:true",
"build": "npm run source && npm run minify",
"dev": "rollup -c -w",
"lint": "eslint src",
"fix": "eslint --fix src",
"test-unit": "nodeunit test/unit/nodeunitheadless.js",
"test": "npm run lint && npm run test-unit",
"semantic-release": "semantic-release pre && npm publish && semantic-release post --owner=sole --user=dalisoft"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tweenjs/es6-tween.git"
},
"keywords": [
"tween",
"tweening",
"es6",
"numeric",
"interpolation",
"easing",
"emit"
],
"author": "es6-tween contributors",
"license": "MIT",
"bugs": {
"url": "https://github.com/tweenjs/es6-tween/issues"
},
"release": {
"branch": "master"
},
"homepage": "https://github.com/tweenjs/es6-tween#readme",
"devDependencies": {
"eslint": "^4.3.0",
"eslint-plugin-import": "^2.7.0",
"nodeunit": "^0.9.1",
"rollup": "^0.41.6",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-uglify": "^2.0.1",
"rollup-watch": "^4.3.1",
"semantic-release": "latest",
"uglify-es": "^3.0.27"
},
"dependencies": {}
}
"name": "es6-tween",
"version": "3.0.1",
"description": "ES6 implementation of amazing tween.js",
"browser": "dist/Tween.min.js",
"cdn": "dist/Tween.min.js",
"main": "dist/Tween.min.js",
"directories": {
"example": "examples"
},
"scripts": {
"source": "rollup -c --environment min:false",
"minify": "rollup -c --environment min:true",
"build": "npm run source && npm run minify",
"dev": "rollup -c -w",
"lint": "eslint src",
"fix": "eslint --fix src",
"test": "nodeunit test/unit/nodeunitheadless.js",
"check": "npm run lint && npm test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tweenjs/es6-tween.git"
},
"keywords": [
"tween",
"tweening",
"es6",
"numeric",
"interpolation",
"easing",
"emit"
],
"author": "es6-tween contributors",
"license": "MIT",
"bugs": {
"url": "https://github.com/tweenjs/es6-tween/issues"
},
"homepage": "https://github.com/tweenjs/es6-tween#readme",
"devDependencies": {
"eslint": "^4.3.0",
"eslint-plugin-import": "^2.7.0",
"nodeunit": "^0.9.1",
"rollup": "^0.41.6",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-uglify": "^2.0.1",
"rollup-watch": "^4.3.1",
"semantic-release": "latest",
"uglify-es": "^3.0.27"
},
"dependencies": {}
}

@@ -124,12 +124,2 @@ # es6-tween

## Bugs/Fixes
#### Helping to avoid false log of `jscs`
```bash
git config core.eol lf
git config core.autocrlf input
git rm --cached -r .
git reset --hard
```
## Features

@@ -152,2 +142,14 @@

## Caveats
##### We removed the shim from core functions for reduce size and improve execution speed, so you need some polyfills to work better
* `Array.isArray`*
* `Object.assign`
* `requestAnimationFrame`*
* `performance.now()`*
* `cancelAnimationFrame`*
* `Array.from`*
`* - optional for best performance, fallback supported in core`
## Examples

@@ -154,0 +156,0 @@

@@ -0,0 +0,0 @@ import buble from 'rollup-plugin-buble'

/* global global, window, Object, document, process, requestAnimationFrame, cancelAnimationFrame, setTimeout, clearTimeout */
import EventClass from './Event'

@@ -8,3 +7,2 @@ let _tweens = {}

let _tick
let {emit, on, once, off} = new EventClass()
let root = typeof (window) !== 'undefined' ? window : typeof (global) !== 'undefined' ? global : {}

@@ -27,6 +25,3 @@ let _nextId = 0

isStarted = true
emit('start')
}
emit('add', tween, _tweens)
}

@@ -109,8 +104,5 @@

emit('update', time, _tweens)
if (_tweens.length === 0) {
isStarted = false
_stopTicker(_tick)
emit('stop', time)
return false

@@ -131,2 +123,4 @@ }

const Plugins = {}
// Normalise time when visiblity is changed (if available) ...

@@ -156,2 +150,2 @@ if (root.document) {

export { get, has, nextId, getAll, removeAll, remove, add, now, update, autoPlay, on, once, off, emit }
export { Plugins, get, has, nextId, getAll, removeAll, remove, add, now, update, autoPlay }

@@ -0,0 +0,0 @@ import Tween from './Tween'

@@ -1,15 +0,4 @@

const bind = (fn, ctx) => {
return function () {
return fn.apply(ctx, arguments)
}
}
export default class EventClass {
constructor () {
this._events = {}
this._bind = this
this.on = bind(this.on, this)
this.once = bind(this.once, this)
this.off = bind(this.off, this)
this.emit = bind(this.emit, this)
}

@@ -16,0 +5,0 @@

@@ -0,0 +0,0 @@ const Store = {

@@ -32,6 +32,10 @@ import toNumber from './toNumber'

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

@@ -90,3 +94,3 @@ if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {

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

@@ -106,4 +110,2 @@ let _endMap = trim(end).replace(hexColor, hexReplace).match(numRegExp).map(toNumber)

}
} else if (typeof end === 'function') {
return end
} else if (!Array.isArray(start) && Array.isArray(end)) {

@@ -114,4 +116,3 @@ end.unshift(start)

} else {
let isSame = start === end
return (t) => isSame ? start : t >= 0.5 ? end : start
return end
}

@@ -118,0 +119,0 @@ }

@@ -0,0 +0,0 @@ import Tween from './Tween'

@@ -0,0 +0,0 @@ export default function toNumber (val) {

@@ -5,3 +5,4 @@ import {

now,
nextId
nextId,
Plugins
}

@@ -33,3 +34,6 @@ from './core'

this.isJoinToString = typeof object === 'string'
if (object.node) {
this.node = object.node
delete object.node
}
this.object = object

@@ -54,2 +58,3 @@ this._valuesStart = Tween.createEmptyConst(object)

this.id = nextId()
this._plugins = {}

@@ -182,2 +187,7 @@ if (instate && instate.to) {

for (let property in _valuesEnd) {
let isPluginProp = Plugins[property]
if (isPluginProp) {
isPluginProp = this._plugins[property] = new Plugins[property](this, object[property], _valuesEnd[property])
isPluginProp.preprocess && isPluginProp.preprocess(object[property], _valuesEnd[property])
}
if (typeof _valuesEnd[property] === 'object' && _valuesEnd[property]) {

@@ -208,2 +218,6 @@ this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property])

this._valuesStart[property] = object[property]
if (isPluginProp) {
isPluginProp.postprocess && isPluginProp.postprocess(this.object[property], this._valuesEnd[property])
}
}

@@ -318,2 +332,3 @@

_valuesEnd,
_plugins,
object

@@ -358,5 +373,8 @@ } = this

let end = _valuesEnd[property]
let plugin = _plugins[property]
value = _easingFunction[property] ? _easingFunction[property](elapsed) : value
if (typeof end === 'function') {
if (plugin) {
plugin.update(value, elapsed, _reversed)
} else if (typeof end === 'function') {
object[property] = end(value)

@@ -363,0 +381,0 @@ } else if (Array.isArray(end)) {

@@ -1,9 +0,8 @@

import { nextId, has, get, getAll, removeAll, remove, add, now, update, autoPlay, on, once, off, emit } from './dist/core'
import { nextId, has, get, getAll, removeAll, remove, add, now, update, autoPlay, Plugins } from './dist/core'
import Easing from './dist/Easing'
import Tween from './dist/Tween'
import Interpolation from './dist/Interpolation'
import Composite from './dist/Composite'
import Timeline from './dist/Timeline'
import Plugins, { PropertyTypes } from './dist/Plugins'
import TweenInit from './dist/Decorators'
export { TweenInit, nextId, has, get, getAll, removeAll, remove, add, now, update, autoPlay, on, once, off, emit, Tween, Easing, Interpolation, Composite, Timeline, Plugins, PropertyTypes }
import SubTween from './dist/SubTween'
export { Plugins, TweenInit, SubTween as Interpolator, nextId, has, get, getAll, removeAll, remove, add, now, update, autoPlay, Tween, Easing, Interpolation, Timeline }

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 not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc