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

es6-tween

Package Overview
Dependencies
Maintainers
1
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-tween - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

src/shim.js

711

dist/Tween.js

@@ -7,21 +7,44 @@ (function (global, factory) {

/* global global, window, Object, document, process, requestAnimationFrame, cancelAnimationFrame, setTimeout, clearTimeout */
/* global global */
var root = typeof (window) !== 'undefined' ? window : typeof (global) !== 'undefined' ? global : this;
var _tweens = {};
if (!Object.assign) {
Object.assign = function (source) {
var args = [], len$1 = arguments.length - 1;
while ( len$1-- > 0 ) args[ len$1 ] = arguments[ len$1 + 1 ];
for (var i = 0, len = args.length; i < len; i++) {
var arg = args[i];
for (var p in arg) {
source[p] = arg[p];
}
}
return source
};
}
if (!Object.create) {
Object.create = function (source) {
return Object.assign({}, source || {})
};
}
if (!Array.isArray) {
Array.isArray = function (source) { return source && source.push && source.splice; };
}
if (typeof (requestAnimationFrame) === 'undefined') {
root.requestAnimationFrame = function (fn) { return root.setTimeout(fn, 16); };
}
if (typeof (cancelAnimationFrame) === 'undefined') {
root.cancelAnimationFrame = function (id) { return root.clearTimeout(id); };
}
/* global process */
var _tweens = [];
var isStarted = false;
var _autoPlay = false;
var _tick;
var root = typeof (window) !== 'undefined' ? window : typeof (global) !== 'undefined' ? global : {};
var _nextId = 0;
var _ticker = root.requestAnimationFrame;
var _stopTicker = root.cancelAnimationFrame;
var _ticker = function (fn) { return typeof (requestAnimationFrame) !== 'undefined' ? requestAnimationFrame(fn) : setTimeout(fn, 16.6); };
var _stopTicker = function (fn) { return typeof (cancelAnimationFrame) !== 'undefined' ? cancelAnimationFrame(fn) : clearTimeout(fn); };
var setProp = function (o, p, param) { return Object.defineProperty(o, p, param); };
setProp(_tweens, 'length', {enumerable: false, writable: true, value: 0});
var add = function (tween) {
var id = tween.id;
_tweens[id] = tween;
_tweens.length++;
_tweens.push(tween);

@@ -34,12 +57,4 @@ if (_autoPlay && !isStarted) {

var nextId = function () {
var id = _nextId;
_nextId++;
return id
};
var getAll = function () { return _tweens; };
var getAll = function () {
return _tweens
};
var autoPlay = function (state) {

@@ -50,6 +65,2 @@ _autoPlay = state;

var removeAll = function () {
for (var id in _tweens) {
_tweens[id] = null;
delete _tweens[id];
}
_tweens.length = 0;

@@ -60,5 +71,5 @@ _stopTicker(_tick);

var get = function (tween) {
for (var searchTween in _tweens) {
if (tween.id === +searchTween) {
return _tweens[searchTween]
for (var i = 0; i < _tweens.length; i++) {
if (tween === _tweens[i]) {
return _tweens[i]
}

@@ -75,9 +86,7 @@ }

var remove = function (tween) {
for (var searchTween in _tweens) {
if (tween.id === +searchTween) {
delete _tweens[searchTween];
_tweens.length--;
}
var i = _tweens.indexOf(tween);
if (i !== -1) {
_tweens.splice(i, 1);
}
if (_tweens.length === 0) {
if (!_tweens.length) {
_stopTicker(_tick);

@@ -115,5 +124,4 @@ }

var i;
var length = _tweens.length;
if (!length) {
var len = _tweens.length;
if (!len) {
isStarted = false;

@@ -124,3 +132,4 @@ _stopTicker(_tick);

for (i in _tweens) {
var i = 0;
for (; i < len; i++) {
_tweens[i].update(time, preserve);

@@ -137,3 +146,3 @@ }

// Normalise time when visiblity is changed (if available) ...
if (root.document) {
if (root.document && root.document.addEventListener) {
var doc = root.document;

@@ -150,4 +159,4 @@ var timeDiff = 0;

for (var tween in _tweens) {
_tweens[tween]._startTime += timeDiff;
for (var i = 0, length = _tweens.length; i < length; i++) {
_tweens[i]._startTime += timeDiff;
}

@@ -418,221 +427,301 @@ _tick = _ticker(update);

var Interpolation = {
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
Linear: function Linear (v, k) {
var m = v.length - 1;
var f = m * k;
var i = Math.floor(f);
var fn = Interpolation.Utils.Linear;
if (k < 0) {
return fn(v[0], v[1], f)
}
if (k > 1) {
return fn(v[m], v[m - 1], m - f)
}
return fn(v[i], v[i + 1 > m ? m : i + 1], f - i)
},
Bezier: function Bezier (v, k) {
var b = 0;
var n = v.length - 1;
var pw = Math.pow;
var bn = Interpolation.Utils.Bernstein;
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
for (var i = 0; i <= n; i++) {
b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
}
var intertween = createCommonjsModule(function (module) {
/**
* @name InterTween
* @description The lightweight, fastest, smartest, effecient value interpolator with no-dependecy, zero-configuration and relative interpolation
* @author dalisoft (https://github.com/dalisoft)
* @license MIT-License
* First Release at 20 August 2017, by @dalisoft
*/
return b
},
CatmullRom: function CatmullRom (v, k) {
var m = v.length - 1;
var f = m * k;
var i = Math.floor(f);
var fn = Interpolation.Utils.CatmullRom;
if (v[0] === v[m]) {
if (k < 0) {
i = Math.floor(f = m * (1 + k));
}
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i)
(function (root, factory) {
if (typeof undefined === 'function' && undefined.amd) {
undefined([], factory);
} else if ('object' !== 'undefined' && module.exports) {
module.exports = factory();
} else {
if (k < 0) {
return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0])
}
if (k > 1) {
return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m])
}
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)
root.InterTween = factory();
}
},
}
(typeof(window) !== 'undefined' ? window : commonjsGlobal, function () {
Utils: {
// RegExp variables
var colorMatch = /rgb/g;
var isIncrementReqForColor = /argb/g;
// This RegExp (numRegExp) is original from @jkroso string tweening and optimized by @dalisoft
var numRegExp =
/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
var hexColor = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i;
var trimRegExp = /\n|\r|\t/g;
var rgbMax = 255;
Linear: function Linear (p0, p1, t) {
return typeof p0 === 'function' ? p0(t) : (p1 - p0) * t + p0
},
// Helpers
function s2f(val) {
var floatedVal = parseFloat(val);
return typeof floatedVal === "number" && !isNaN(floatedVal) ? floatedVal : val;
}
var isArray = Array.isArray;
Bernstein: function Bernstein (n, i) {
var fc = Interpolation.Utils.Factorial;
function h2r_f(all, hex) {
var r;
var g;
var b;
if (hex.length === 3) {
r = hex[0];
g = hex[1];
b = hex[2];
hex = r + r + g + g + b + b;
}
var color = parseInt(hex, 16);
r = color >> 16 & rgbMax;
g = color >> 8 & rgbMax;
b = color & rgbMax;
return "rgb(" + r + "," + g + "," + b + ")";
}
return fc(n) / fc(i) / fc(n - i)
},
function trim(str) {
return typeof str === "string" ? str.replace(trimRegExp, "") : str;
}
var relativeModes = {
'+=': 1,
'-=': 1,
'*=': 2,
'/=': 3,
'%=': 4
};
Factorial: (function () {
var a = [1];
function r2n(s, e) {
if (typeof e === 'number') {
return e;
} else {
var rv = relativeModes[e.substr(0, 2)],
v = e.substr(2);
if (rv === 1) {
var e2 = e[0] + v;
return s + parseFloat(e2);
} else if (rv === 2) {
return s * +v;
} else if (rv === 3) {
return s / +v;
} else if (rv === 4) {
return s * (+v / 100);
}
}
return e;
}
return function (n) {
var s = 1;
var h2r = function (hex) {
return typeof hex !== 'string' ? hex : trim(hex)
.replace(hexColor, h2r_f);
};
if (a[n]) {
return a[n]
function s2n(str) {
return h2r(str).match(numRegExp).map(s2f);
}
for (var i = n; i > 1; i--) {
s *= i;
// Splitted functions
function stringTween(s, e, d) {
d = d !== undefined ? d : 10000;
if (!numRegExp.test(e))
{ return e; }
var sv = s2n(s);
var ev = s2n(e);
var uv = unitTween(sv, ev, d);
if (uv) {
return uv;
}
uv = null;
var cm = null;
var cmls = null;
var rv = [];
for (var i = 0, len = ev.length; i < len; i++) {
var ve = ev[i],
vs = sv[i];
rv[i] = typeof ve === 'string' && ve.indexOf('=') === 1 ? e : null;
if (isIncrementReqForColor.test(ve)) {
cm = i + 2;
cmls = i + 11;
} else if (colorMatch.test(ve)) {
cm = i;
cmls = i + 9;
}
ev[i] = vs === ve ? null : rv[i] !== null ? r2n(vs, ve) : typeof ve === 'number' ? ve - vs : ve;
}
return function (t) {
var str = '';
for (var i = 0, len = ev.length; i < len; i++) {
var a = sv[i],
b = ev[i],
r = rv[i];
str += typeof b === 'number' ? cm !== null && i > cm &&
i < cmls ? (a + b * t) | 0 : (((a + b * t) * d) |
0) / d : a;
if (t === 1 && r !== null) {
sv[i] += b;
ev[i] = r2n(sv[i], r);
}
}
return str;
}
}
a[n] = s;
return s
}
})(),
function tweenThemTo(sv, ev) {
var vs = [];
for (var i = 0, len = sv.length; i < len; i++) {
var s = sv[i];
vs[i] = isArray(s) ? arrayTween(s, ev) : typeof s === 'object' ? objectTween(s, ev) : typeof s === 'string' ? stringTween(s, ev) : s;
}
return function (t) {
for (var i = 0, len = vs.length; i < len; i++) {
sv[i] = vs[i](t);
}
return sv;
}
}
CatmullRom: function CatmullRom (p0, p1, p2, p3, t) {
var v0 = (p2 - p0) * 0.5;
var v1 = (p3 - p1) * 0.5;
var t2 = t * t;
var t3 = t * t2;
function parseInterpolatables(sv, ev) {
var vs = [];
for (var i = 0, len = ev.length; i < len; i++) {
var e = ev[i];
vs[i] = mainTween(i === 0 ? sv : ev[i - 1], e);
}
var lastItem = ev[ev.length - 1];
vs.push(mainTween(lastItem, lastItem));
var endLength = vs.length - 1;
return function (t) {
var totalTime = t * endLength;
var roundedTime = Math.floor(totalTime);
var elapsed = totalTime - roundedTime;
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1
}
var item = vs[roundedTime];
var interpolated = item(elapsed);
return interpolated;
};
}
}
function arrayTween(sv, ev, d) {
d = d !== undefined ? d : 10000;
var s = sv.slice();
var rv = [];
for (var i = 0, len = ev.length; i < len; i++) {
var vs = s[i],
ve = ev[i];
rv[i] = typeof ve === 'string' && ve.indexOf('=') === 1 ? ve : null;
s[i] = vs === ve ? null : isArray(ve) ?
isArray(vs) && ve.length === vs.length ? arrayTween(vs, ve, d) : parseInterpolatables(vs, ve) : isArray(vs) ? tweenThemTo(vs, ve) : typeof ve === 'object' ?
objectTween(vs, ve, d) : typeof ve === 'string' ?
stringTween(vs, ve, d) : vs;
ev[i] = rv[i] !== null ? r2n(
vs, ve) : ve;
}
return function (t) {
for (var i = 0, len = ev.length; i < len; i++) {
var a = s[i],
b = ev[i],
r = rv[i];
if (a === null)
{ continue; }
sv[i] = typeof a === 'number' ? (((a + (b - a) * t) * d) | 0) /
d : typeof a === 'function' ? a(t) : a.update ? a.update(t) : b;
if (r && t === 1) {
s[i] = b;
ev[i] = r2n(s[i], r);
}
}
return sv;
}
}
};
var units = ["px", "pt", "pc", "deg", "rad", "turn", "em", "ex", "cm", "mm", "dm", "inch", "in", "rem", "vw", "vh", "vmin", "vmax", "%"];
function unitTween(sv, ev, d) {
d = d !== undefined ? d : 10000;
if (ev.length === 2 && sv.length === 2) {
var unidx = units.indexOf(ev[1]);
if (unidx !== -1) {
var s = +sv[0],
e = +ev[0],
u = ev[1],
r = typeof ev[0] === 'string' && ev[0].indexOf('=') === 1 ? ev[0] : null;
if (r) {
e = r2n(s, e);
}
return function (t) {
var v = ((((s + (e - s) * t) * d) | 0) / d) + u;
if (r && t === 1) {
s = e;
e = r2n(s, r);
}
return v;
}
}
}
return false;
}
function toNumber (val) {
var floatedVal = parseFloat(val);
return typeof floatedVal === 'number' && !isNaN(floatedVal) ? floatedVal : val
}
var colorMatch = /rgb|hsl|hsv/g;
var isIncrementReqForColor = /ahsv|ahsl|argb/g;
// Credits:
// @jkroso for string parse library
// Optimized, Extended by @dalisoft
var numRegExp =
/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
var hexColor = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i;
var trimRegExp = /\n|\r|\t/g;
var hexReplace = function (all, hex) {
var r;
var g;
var b;
if (hex.length === 3) {
r = parseInt(hex[0] + hex[0], 16);
g = parseInt(hex[1] + hex[1], 16);
b = parseInt(hex[2] + hex[2], 16);
} else if (hex.length === 6) {
r = parseInt(hex.substr(0, 2), 16);
g = parseInt(hex.substr(2, 2), 16);
b = parseInt(hex.substr(4, 6), 16);
}
return ("rgb(" + r + "," + g + "," + b + ")")
};
var trim = function (str) { return typeof str === 'string' ? str.replace(trimRegExp, '') : str; };
var SubTween = function (start, end, roundv) {
if ( roundv === void 0 ) roundv = 10000;
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 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;
if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {
startIndex++;
endIndex++;
}
var map = [].concat( start );
return function (t) {
for (var i = 0, v = (void 0), length = end.length; i < length; i++) {
v = end[i];
if (typeof v === 'function') {
map[i] = v(t);
} else if (typeof v === 'number') {
map[i] = (((start[i] + v * t) * roundv) | 0) / roundv;
if (startIndex !== null && i > startIndex && i < endIndex) {
map[i] = map[i] | 0;
}
function objectTween(sv, ev, d) {
d = d !== undefined ? d : 10000;
var rv = {};
var s = {};
for (var i in ev) {
s[i] = sv[i];
var vs = s[i],
ve = ev[i];
rv[i] = typeof ve === 'string' && ve.indexOf('=') === 1 ? ve : null;
s[i] = vs === ve ? null : isArray(ve) ?
isArray(vs) && ve.length === vs.length ? arrayTween(vs, ve, d) : parseInterpolatables(vs, ve) : isArray(vs) ? tweenThemTo(vs, ve) : typeof ve === 'object' ?
objectTween(vs, ve, d) : typeof ve === 'string' ?
stringTween(vs, ve, d) : vs;
ev[i] = rv[i] !== null ? r2n(vs, ve) : ve;
}
return function (t) {
for (var i in ev) {
var a = s[i],
b = ev[i],
r = rv[i];
if (a === null)
{ continue; }
sv[i] = typeof a === 'number' ? (((a + (b - a) * t) * d) | 0) /
d : typeof a === 'function' ? a(t) : a.update ? a.update(t) : b;
if (r && t === 1) {
s[i] = b;
ev[i] = r2n(s[i], r);
}
}
return sv;
}
}
}
return map
}
} else if (typeof start === 'object') {
for (var property in end) {
if (end[property] === start[property]) {
end[property] = null;
} else if (typeof start[property] === 'number') {
end[property] -= start[property];
} else if (typeof end[property] === 'object' || (typeof end[property] === 'string' && numRegExp.test(end[property]))) {
end[property] = SubTween(start[property], end[property]);
}
}
var map$1 = Object.assign({}, start);
return function (t) {
for (var property in end) {
var to = end[property];
if (typeof to === 'function') {
map$1[property] = to(t);
} else if (typeof to === 'number') {
map$1[property] = (((start[property] + to * t) * roundv) | 0) / roundv;
function mainTween(sv, ev, d) {
d = d !== undefined ? d : 10000;
var rv = typeof(ev) === 'string' && typeof sv === 'number' && ev.indexOf('=') === 1 ? ev : null;
if (rv) {
ev = r2n(sv, rv);
}
return isArray(ev) ? isArray(sv) && sv.length === ev.length ? arrayTween(sv, ev, d) : parseInterpolatables(sv, ev) : isArray(sv) ? tweenThemTo(sv, ev) : typeof ev === 'object' ?
objectTween(sv, ev, d) : typeof ev === 'string' ? stringTween(sv, ev, d) :
typeof ev === 'function' ? ev : function (t) {
var vv = typeof ev === 'number' ? (((sv + (ev - sv) * t) *
d) | 0) / d : sv;
if (rv && t === 1) {
sv += ev;
ev = r2n(sv, rv);
}
return vv;
}
}
}
return map$1
}
} else if (typeof start === 'number') {
end -= start;
var isSame = start === end;
return function (t) {
return isSame ? end : (((start + end * t) * roundv) | 0) / roundv
}
} 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);
var _endMap = trim(end).replace(hexColor, hexReplace).match(numRegExp).map(toNumber);
var _tween = SubTween(_startMap, _endMap);
return function (t) {
var _t = _tween(t);
var i = 0;
var s = '';
while (i < _t.length) {
s += _t[i];
i++;
}
return mainTween;
return s
}
} else if (!Array.isArray(start) && Array.isArray(end)) {
return end.map(function (v, i) { return SubTween(i === 0 ? start : end[i - 1], v); })
} else {
return end
}
};
}));
});

@@ -707,9 +796,11 @@ var Store = {};

if (event === undefined || !_events[event]) {
var _event = _events[event];
if (!_event || !_event.length) {
return this
}
var _event = _events[event];
for (var i = 0, length = _event.length; i < length; i++) {
var i = 0;
var len = _event.length;
for (; i < len; i++) {
_event[i](arg1, arg2, arg3, arg4);

@@ -733,2 +824,4 @@ }

var _id = 0; // Unique ID
var Tween = (function (EventClass$$1) {

@@ -738,4 +831,4 @@ function Tween (node, object) {

this.id = nextId();
if (typeof node === 'object' && !object && !node.nodeType) {
this.id = _id++;
if (typeof node !== 'undefined' && !object && !node.nodeType) {
object = this.object = node;

@@ -745,11 +838,13 @@ node = null;

this.node = node;
object = this.object = NodeCache(node, object);
this.object.node = node;
if (typeof object === 'object') {
object = this.object = NodeCache(node, object);
this.object.node = node;
} else {
this.object = object;
}
}
this._valuesStart = Tween.createEmptyConst(object);
this._valuesEnd = Tween.createEmptyConst(object);
this._valuesEnd = null;
this._duration = 1000;
this._easingFunction = defaultEasing;
this._interpolationFunction = Interpolation.Linear;

@@ -766,3 +861,2 @@ this._startTime = 0;

this._pausedTime = null;
this._plugins = {};
this._isFinite = true;

@@ -777,18 +871,2 @@

Tween.prototype.timeout = function timeout (fn, delay) {
return new Tween({x: 0}).to({x: 1}, delay).on('complete', fn)
};
Tween.prototype.interval = function interval (fn, delay) {
return new Tween({x: 0}).to({x: 1}, delay).repeat(Infinity).on('repeat', fn)
};
Tween.createEmptyConst = function createEmptyConst (oldObject) {
return typeof (oldObject) === 'number' ? 0 : Array.isArray(oldObject) ? [] : typeof (oldObject) === 'object' ? {}
: ''
};
Tween.checkValidness = function checkValidness (valid) {
return valid !== undefined && valid !== null && valid !== '' && ((typeof valid === 'number' && !isNaN(valid)) || typeof valid !== 'number') && valid !== Infinity
};
Tween.prototype.isPlaying = function isPlaying () {

@@ -870,10 +948,7 @@ return this._isPlaying

var this$1 = this;
if ( properties === void 0 ) properties = {};
if ( duration === void 0 ) duration = 1000;
if (typeof properties === 'object') {
this._valuesEnd = properties;
}
this._valuesEnd = properties;
if (typeof duration === 'number') {
if (typeof duration === 'number' || typeof (duration) === 'function') {
this._duration = typeof (duration) === 'function' ? duration(this._duration) : duration;

@@ -900,36 +975,18 @@ } else if (typeof duration === 'object') {

var ref = this;
var _valuesStart = ref._valuesStart;
var _valuesEnd = ref._valuesEnd;
var object = ref.object;
var _plugins = ref._plugins;
var Renderer = ref.Renderer;
for (var property in _valuesEnd) {
var isPluginProp = Plugins[property];
if (isPluginProp) {
isPluginProp = _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] && typeof object[property] === 'object') {
_valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
if (typeof _valuesEnd[property] === 'function') {
object[property] = _valuesEnd[property](0);
if (typeof _valuesEnd === 'object') {
for (var property in _valuesEnd) {
if (Plugins[property]) {
_valuesEnd[property] = new Plugins[property](this$1, object[property], _valuesEnd[property]);
}
} else if (typeof _valuesEnd[property] === 'string' && typeof object[property] === 'string') {
_valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
if (typeof _valuesEnd[property] === 'function') {
object[property] = _valuesEnd[property](0);
}
}
}
// If `to()` specifies a property that doesn't exist in the source object,
// we should not set that property in the object
if (Tween.checkValidness(object[property]) === false) {
continue
}
this._valuesEnd = _valuesEnd = intertween(object, _valuesEnd);
_valuesStart[property] = object[property];
if (isPluginProp) {
isPluginProp.postprocess && isPluginProp.postprocess(object[property], _valuesEnd[property]);
}
if (Renderer && this.node) {
this.__render = new Renderer(this, _valuesEnd);
}

@@ -1018,11 +1075,4 @@

Tween.prototype.interpolation = function interpolation (fn) {
this._interpolationFunction = fn;
return this
};
Tween.prototype.reassignValues = function reassignValues () {
var ref = this;
var _valuesStart = ref._valuesStart;
var _valuesEnd = ref._valuesEnd;

@@ -1033,6 +1083,5 @@ var object = ref.object;

var end = _valuesEnd[property];
var start = _valuesStart[property];
if (typeof end === 'number' || typeof end === 'string') {
object[property] = start;
object[property] = end(0);
}

@@ -1053,3 +1102,2 @@ }

var _easingFunction = ref._easingFunction;
var _interpolationFunction = ref._interpolationFunction;
var _repeat = ref._repeat;

@@ -1062,9 +1110,7 @@ var _repeatDelayTime = ref._repeatDelayTime;

var _duration = ref._duration;
var _valuesStart = ref._valuesStart;
var _valuesEnd = ref._valuesEnd;
var _plugins = ref._plugins;
var object = ref.object;
var _isFinite = ref._isFinite;
var __render = ref.__render;
var property;
var elapsed;

@@ -1095,32 +1141,8 @@ var value;

value = typeof _easingFunction === 'function' ? _easingFunction(elapsed) : defaultEasing(elapsed);
value = _easingFunction(elapsed);
for (property in _valuesEnd) {
var start = _valuesStart[property];
var end = _valuesEnd[property];
var plugin = _plugins[property];
value = _easingFunction[property] ? _easingFunction[property](elapsed) : value;
object = _valuesEnd(value);
if (plugin && plugin.update) {
plugin.update(value, elapsed, _reversed);
} else if (start === null || start === undefined) {
continue
} else if (typeof end === 'function') {
object[property] = end(value);
} else if (Array.isArray(end)) {
object[property] = _interpolationFunction(end, value);
} else if (typeof (end) === 'number') {
object[property] = start + (end - start) * value;
} else if (typeof (end) === 'string') {
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
end = start + parseFloat(end);
} else {
end = parseFloat(end);
}
// Protect against non numeric properties.
if (typeof (end) === 'number') {
object[property] = start + (end - start) * value;
}
}
if (__render) {
__render.update(object, elapsed);
}

@@ -1136,21 +1158,12 @@

for (property in _valuesEnd) {
if (typeof (_valuesEnd[property]) === 'string' && typeof (_valuesStart[property]) === 'number') {
_valuesStart[property] = _valuesStart[property] + parseFloat(_valuesEnd[property]);
}
}
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? EVENT_REVERSE : EVENT_REPEAT, object);
if (_yoyo) {
this.reverse();
this._reversed = !_reversed;
}
if (!_reversed && _repeatDelayTime) {
this._startTime += _duration + _repeatDelayTime;
this._startTime = time + _repeatDelayTime;
} else if (_reversed && _reverseDelayTime) {
this._startTime += _duration + _reverseDelayTime;
this._startTime = time + _reverseDelayTime;
} else {
this._startTime += _duration;
this._startTime = time;
}

@@ -1237,3 +1250,3 @@

var _id = 0;
var _id$1 = 0;
var Timeline = (function (Tween$$1) {

@@ -1246,3 +1259,3 @@ function Timeline (params) {

this._elapsed = 0;
this._id = _id++;
this._id = _id$1++;
this._defaultParams = params;

@@ -1423,4 +1436,3 @@ this.position = new PlaybackPosition();

exports.Plugins = Plugins;
exports.Interpolator = SubTween;
exports.nextId = nextId;
exports.Interpolator = intertween;
exports.has = has;

@@ -1438,3 +1450,2 @@ exports.get = get;

exports.Easing = Easing;
exports.Interpolation = Interpolation;
exports.Timeline = Timeline;

@@ -1441,0 +1452,0 @@

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.TWEEN=t.TWEEN||{})}(this,function(t){"use strict";function e(t){var e=parseFloat(t);return"number"!=typeof e||isNaN(e)?t:e}var n,r={},i=!1,o=!1,s="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a=0,u=function(t){return"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(t):setTimeout(t,16.6)},p=function(t){return"undefined"!=typeof cancelAnimationFrame?cancelAnimationFrame(t):clearTimeout(t)};!function(t,e,n){Object.defineProperty(t,e,n)}(r,"length",{enumerable:!1,writable:!0,value:0});var f=function(t){var e=t.id;r[e]=t,r.length++,o&&!i&&(n=u(d),i=!0)},h=function(){var t=a;return a++,t},c=function(t){for(var e in r)if(t.id===+e)return r[e];return null},l=function(t){for(var e in r)t.id===+e&&(delete r[e],r.length--);0===r.length&&p(n)},y=function(){if("undefined"!=typeof process&&void 0!==process.hrtime)return function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6};if(void 0!==s.performance&&void 0!==s.performance.now)return s.performance.now.bind(s.performance);var t=s.performance&&s.performance.timing&&s.performance.timing.navigationStart?s.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}(),d=function(t,e){t=void 0!==t?t:y(),n=u(d);var o;if(!r.length)return i=!1,p(n),!1;for(o in r)r[o].update(t,e);return!0},_={};if(s.document){var v=0,m=0;s.document.addEventListener("visibilitychange",function(){if(document.hidden)m=y(),p(n),i=!1;else{v=y()-m;for(var t in r)r[t]._startTime+=v;n=u(d),i=!0}return!0})}var b={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-b.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*b.Bounce.In(2*t):.5*b.Bounce.Out(2*t-1)+.5}}},g={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=g.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=g.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=g.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 t?t(n):(e-t)*n+t},Bernstein:function(t,e){var n=g.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:function(){var t=[1];return function(e){var n=1;if(t[e])return t[e];for(var r=e;r>1;r--)n*=r;return t[e]=n,n}}(),CatmullRom:function(t,e,n,r,i){var o=.5*(n-t),s=.5*(r-e),a=i*i;return(2*e-2*n+o+s)*(i*a)+(-3*e+3*n-2*o-s)*a+o*i+e}}},T=/rgb|hsl|hsv/g,I=/ahsv|ahsl|argb/g,M=/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,O=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,w=/\n|\r|\t/g,j=function(t,e){var n,r,i;return 3===e.length?(n=parseInt(e[0]+e[0],16),r=parseInt(e[1]+e[1],16),i=parseInt(e[2]+e[2],16)):6===e.length&&(n=parseInt(e.substr(0,2),16),r=parseInt(e.substr(2,2),16),i=parseInt(e.substr(4,6),16)),"rgb("+n+","+r+","+i+")"},F=function(t){return"string"==typeof t?t.replace(w,""):t},A=function(t,n,r){if(void 0===r&&(r=1e4),"function"==typeof n||n&&n.nodeType)return n;if(t&&t.nodeType)return t;if(Array.isArray(t)){var i=null,o=null;n=n.map(function(e,n){return"string"==typeof e&&T.test(e)?(i=e,o=n,null):e===t[n]?null:"number"==typeof e?e-t[n]:"string"==typeof e&&M.test(e)?A(F(t[n]),F(e)):A(t[n],e)});var s=null!==o?o+6:null;i&&I.test(i)&&(o++,s++);var a=[].concat(t);return function(e){for(var i=0,u=void 0,p=n.length;i<p;i++)"function"==typeof(u=n[i])?a[i]=u(e):"number"==typeof u&&(a[i]=((t[i]+u*e)*r|0)/r,null!==o&&i>o&&i<s&&(a[i]=0|a[i]));return a}}if("object"==typeof t){for(var u in n)n[u]===t[u]?n[u]=null:"number"==typeof t[u]?n[u]-=t[u]:("object"==typeof n[u]||"string"==typeof n[u]&&M.test(n[u]))&&(n[u]=A(t[u],n[u]));var p=Object.assign({},t);return function(e){for(var i in n){var o=n[i];"function"==typeof o?p[i]=o(e):"number"==typeof o&&(p[i]=((t[i]+o*e)*r|0)/r)}return p}}if("number"==typeof t){var f=t===(n-=t);return function(e){return f?n:((t+n*e)*r|0)/r}}if("string"==typeof t&&"string"==typeof n&&M.test(t)&&M.test(n)||"string"==typeof n&&t&&(O.test(t)||O.test(n))){var h=F(t).replace(O,j).match(M).map(e),c=F(n).replace(O,j).match(M).map(e),l=A(h,c);return function(t){for(var e=l(t),n=0,r="";n<e.length;)r+=e[n],n++;return r}}return!Array.isArray(t)&&Array.isArray(n)?n.map(function(e,r){return A(0===r?t:n[r-1],e)}):n},P={},D=function(t,e){return t?P[t]?e?Object.assign(P[t],e):P[t]:(P[t]=e,P[t]):e},L=function(){this._events={}};L.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e),this},L.prototype.once=function(t,e){var n=this;this._events[t]||(this._events[t]=[]);var r=this._events,i=r[t].length;return this._events[t].push(function(){for(var o=[],s=arguments.length;s--;)o[s]=arguments[s];e.apply(n,o),r[t].splice(i,1)}),this},L.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},L.prototype.emit=function(t,e,n,r,i){var o=this._events;if(void 0===t||!o[t])return this;for(var s=o[t],a=0,u=s.length;a<u;a++)s[a](e,n,r,i)};var x=b.Linear.None,k=function(t){function e(n,r){return t.call(this),this.id=h(),"object"!=typeof n||r||n.nodeType?void 0!==n&&(this.node=n,r=this.object=D(n,r),this.object.node=n):(r=this.object=n,n=null),this._valuesStart=e.createEmptyConst(r),this._valuesEnd=e.createEmptyConst(r),this._duration=1e3,this._easingFunction=x,this._interpolationFunction=g.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._plugins={},this._isFinite=!0,this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.timeout=function(t,n){return new e({x:0}).to({x:1},n).on("complete",t)},e.prototype.interval=function(t,n){return new e({x:0}).to({x:1},n).repeat(1/0).on("repeat",t)},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.pause=function(){return this._isPlaying?(this._isPlaying=!1,l(this),this._pausedTime=y(),this.emit("pause",this.object)):this},e.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=y()-this._pausedTime,f(this),this._pausedTime=y(),this.emit("play",this.object))},e.prototype.restart=function(t){return this._repeat=this._r,this._startTime=y()+(t?0:this._delayTime),this._isPlaying||f(this),this.emit("restart",this._object)},e.prototype.seek=function(t,e){return this._startTime=y()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this._object),e?this:this.pause()},e.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},e.prototype.to=function(t,e){var n=this;if(void 0===t&&(t={}),void 0===e&&(e=1e3),"object"==typeof t&&(this._valuesEnd=t),"number"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var r in e)n[r]&&(i=n)[r].apply(i,Array.isArray(e)?e:[e]);return this;var i},e.prototype.render=function(){var t=this;if(this._rendered)return this;var n=this,r=n._valuesStart,i=n._valuesEnd,o=n.object,s=n._plugins;for(var a in i){var u=_[a];u&&(u=s[a]=new _[a](t,o[a],i[a])).preprocess&&u.preprocess(o[a],i[a]),"object"==typeof i[a]&&i[a]&&"object"==typeof o[a]?(i[a]=A(o[a],i[a]),"function"==typeof i[a]&&(o[a]=i[a](0))):"string"==typeof i[a]&&"string"==typeof o[a]&&(i[a]=A(o[a],i[a]),"function"==typeof i[a]&&(o[a]=i[a](0))),!1!==e.checkValidness(o[a])&&(r[a]=o[a],u&&u.postprocess&&u.postprocess(o[a],i[a]))}return this},e.prototype.start=function(t){return this._startTime=void 0!==t?t:y(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,f(this),this.emit("start",this.object),this._isPlaying=!0,this},e.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object;return e?(l(this),this._isPlaying=!1,this.emit("stop",n)):this},e.prototype.end=function(){var t=this,e=t._startTime,n=t._duration;return this.update(e+n)},e.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this._startTime+=this._delayTime,this},e.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this._isFinite=isFinite(t),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.reassignValues=function(){var t=this,e=t._valuesStart,n=t._valuesEnd,r=t.object;for(var i in n){var o=n[i],s=e[i];"number"!=typeof o&&"string"!=typeof o||(r[i]=s)}return this},e.prototype.get=function(t){return this.update(t),this.object},e.prototype.update=function(t,e){var n,r,i,o=this,s=o._onStartCallbackFired,a=o._easingFunction,u=o._interpolationFunction,p=o._repeat,f=o._repeatDelayTime,h=o._reverseDelayTime,c=o._yoyo,d=o._reversed,_=o._startTime,v=o._duration,m=o._valuesStart,b=o._valuesEnd,g=o._plugins,T=o.object,I=o._isFinite;if((t=void 0!==t?t:y())<_)return!0;s||(this._rendered||(this.render(),this.emit("start",T),this._rendered=!0),this._onStartCallbackFired=!0),r=(r=(t-_)/v)>1?1:r,r=d?1-r:r,i="function"==typeof a?a(r):x(r);for(n in b){var M=m[n],O=b[n],w=g[n];if(i=a[n]?a[n](r):i,w&&w.update)w.update(i,r,d);else{if(null===M||void 0===M)continue;"function"==typeof O?T[n]=O(i):Array.isArray(O)?T[n]=u(O,i):"number"==typeof O?T[n]=M+(O-M)*i:"string"==typeof O&&"number"==typeof(O="+"===O.charAt(0)||"-"===O.charAt(0)?M+parseFloat(O):parseFloat(O))&&(T[n]=M+(O-M)*i)}}if(this.emit("update",T,i,r),1===r||d&&0===r){if(p){I&&this._repeat--;for(n in b)"string"==typeof b[n]&&"number"==typeof m[n]&&(m[n]=m[n]+parseFloat(b[n]));return this.emit(d?"reverse":"repeat",T),c&&this.reverse(),this._startTime+=!d&&f?v+f:d&&h?v+h:v,!0}return e||l(this),this.emit("complete",T),this._repeat=this._r,!1}return!0},e}(L),E=function(){this.totalTime=0,this.labels=[],this.offsets=[]};E.prototype.parseLabel=function(t,e){var n=this,r=n.offsets,i=n.labels,o=i.indexOf(t);if("string"==typeof t&&-1!==t.indexOf("=")&&!e&&-1===o){var s=t.substr(t.indexOf("=")-1,2),a=t.split(s);e=2===a.length?s+a[1]:null,t=a[0],o=i.indexOf(t)}if(-1!==o&&t){var u=r[o]||0;if("number"==typeof e)u=e;else if("string"==typeof e&&-1!==e.indexOf("=")){var p=e.charAt(0);e=Number(e.substr(2)),"+"===p||"-"===p?u+=parseFloat(p+e):"*"===p?u*=e:"/"===p?u/=e:"%"===p&&(u*=e/100)}return u}return"number"==typeof e?e:0},E.prototype.addLabel=function(t,e){return this.labels.push(t),this.offsets.push(this.parseLabel(t,e)),this},E.prototype.setLabel=function(t,e){var n=this.labels.indexOf(t);return-1!==n&&this.offsets.splice(n,1,this.parseLabel(t,e)),this},E.prototype.eraseLabel=function(t){var e=this.labels.indexOf(t);return-1!==e&&(this.labels.splice(e,1),this.offsets.splice(e,1)),this};var C=0,S=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=y(),this._tweens={},this._elapsed=0,this._id=C++,this._defaultParams=e,this.position=new E,this.position.addLabel("afterLast",this._totalDuration),this.position.addLabel("afterInit",this._startTime),this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addLabel=function(t,e){return this.position.addLabel(t,e),this},e.prototype.map=function(t){var e=this;for(var n in e._tweens){var r=e._tweens[n];t(r,+n),e._totalDuration=Math.max(e._totalDuration,r._duration+r._startTime)}return this},e.prototype.add=function(e,n){var r=this;if(Array.isArray(e))return e.map(function(t){r.add(t,n)}),this;"object"!=typeof e||e instanceof t||(e=new t(e.from).to(e.to,e));var i=this,o=i._defaultParams,s=i._totalDuration;if(o)for(var a in o)e[a](o[a]);var u="number"==typeof n?n:this.position.parseLabel(void 0!==n?n:"afterLast",null);return e._startTime=this._startTime,e._startTime+=u,this._totalDuration=Math.max(s,e._startTime+e._delayTime+e._duration),this._tweens[e.id]=e,this.position.setLabel("afterLast",this._totalDuration),this},e.prototype.restart=function(){return this._startTime+=y(),f(this),this.emit("restart")},e.prototype.easing=function(t){return this.map(function(e){return e.easing(t)})},e.prototype.interpolation=function(t){return this.map(function(e){return e.interpolation(t)})},e.prototype.reverse=function(){return this._reversed=!this._reversed,this.emit("reverse")},e.prototype.update=function(t){var e=this,n=e._tweens,r=e._totalDuration,i=e._repeatDelayTime,o=e._reverseDelayTime,s=e._startTime,a=e._reversed,u=e._yoyo,p=e._repeat,f=e._isFinite;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 c=t-s,l=a?r-c:c;for(var y in n){var d=n[y];if(d.skip)d.skip=!1;else{if(d.update(l))continue;d.skip=!0}}if(this.emit("update",h,c),1===h||a&&0===h){if(p){f&&this._repeat--,this.emit(a?"reverse":"repeat"),u&&this.reverse(),this._startTime+=!a&&i?r+i:a&&o?r+o:r;for(var _ in n){var v=n[_];v.skip&&(v.skip=!1),v.reassignValues()}return!0}this.emit("complete"),this._repeat=this._r;for(var m in n){var b=n[m];b.skip&&(b.skip=!1)}return!1}return!0},e.prototype.elapsed=function(t){return void 0!==t?this.update(t*this._totalDuration):this._elapsed},e.prototype.seek=function(t){return this.update(t<1.1?t*this._totalDuration:t)},e}(k);t.Plugins=_,t.Interpolator=A,t.nextId=h,t.has=function(t){return null!==c(t)},t.get=c,t.getAll=function(){return r},t.removeAll=function(){for(var t in r)r[t]=null,delete r[t];r.length=0,p(n)},t.remove=l,t.add=f,t.now=y,t.update=d,t.autoPlay=function(t){o=t},t.isRunning=function(){return i},t.Tween=k,t.Easing=b,t.Interpolation=g,t.Timeline=S,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";var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:this;Object.assign||(Object.assign=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];for(var r=0,i=e.length;r<i;r++){var o=e[r];for(var s in o)t[s]=o[s]}return t}),Object.create||(Object.create=function(t){return Object.assign({},t||{})}),Array.isArray||(Array.isArray=function(t){return t&&t.push&&t.splice}),"undefined"==typeof requestAnimationFrame&&(e.requestAnimationFrame=function(t){return e.setTimeout(t,16)}),"undefined"==typeof cancelAnimationFrame&&(e.cancelAnimationFrame=function(t){return e.clearTimeout(t)});var n,r=[],i=!1,o=!1,s=e.requestAnimationFrame,a=e.cancelAnimationFrame,u=function(t){r.push(t),o&&!i&&(n=s(c),i=!0)},f=function(t){for(var e=0;e<r.length;e++)if(t===r[e])return r[e];return null},h=function(t){var e=r.indexOf(t);-1!==e&&r.splice(e,1),r.length||a(n)},p=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!==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}}(),c=function(t,e){t=void 0!==t?t:p(),n=s(c);var o=r.length;if(!o)return i=!1,a(n),!1;for(var u=0;u<o;u++)r[u].update(t,e);return!0},l={};if(e.document&&e.document.addEventListener){var d=0,y=0;e.document.addEventListener("visibilitychange",function(){if(document.hidden)y=p(),a(n),i=!1;else{d=p()-y;for(var t=0,e=r.length;t<e;t++)r[t]._startTime+=d;n=s(c),i=!0}return!0})}var v={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-v.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*v.Bounce.In(2*t):.5*v.Bounce.Out(2*t-1)+.5}}},_="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},m=function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t){!function(e,n){t.exports?t.exports=n():e.InterTween=n()}("undefined"!=typeof window?window:_,function(){function t(t){var e=parseFloat(t);return"number"!=typeof e||isNaN(e)?t:e}function e(t,e){var n,r,i;3===e.length&&(e=(n=e[0])+n+(r=e[1])+r+(i=e[2])+i);var o=parseInt(e,16);return n=o>>16&_,r=o>>8&_,i=o&_,"rgb("+n+","+r+","+i+")"}function n(t){return"string"==typeof t?t.replace(v,""):t}function r(t,e){if("number"==typeof e)return e;var n=g[e.substr(0,2)],r=e.substr(2);if(1===n){var i=e[0]+r;return t+parseFloat(i)}return 2===n?t*+r:3===n?t/+r:4===n?t*(+r/100):e}function i(e){return b(e).match(d).map(t)}function o(t,e,n){if(n=void 0!==n?n:1e4,!d.test(e))return e;var o=i(t),s=i(e),a=f(o,s,n);if(a)return a;a=null;for(var u=null,h=null,p=[],y=0,v=s.length;y<v;y++){var _=s[y],m=o[y];p[y]="string"==typeof _&&1===_.indexOf("=")?e:null,l.test(_)?(u=y+2,h=y+11):c.test(_)&&(u=y,h=y+9),s[y]=m===_?null:null!==p[y]?r(m,_):"number"==typeof _?_-m:_}return function(t){for(var e="",i=0,a=s.length;i<a;i++){var f=o[i],c=s[i],l=p[i];e+="number"==typeof c?null!==u&&i>u&&i<h?f+c*t|0:((f+c*t)*n|0)/n:f,1===t&&null!==l&&(o[i]+=c,s[i]=r(o[i],l))}return e}}function s(t,e){for(var n=[],r=0,i=t.length;r<i;r++){var s=t[r];n[r]=m(s)?u(s,e):"object"==typeof s?h(s,e):"string"==typeof s?o(s,e):s}return function(e){for(var r=0,i=n.length;r<i;r++)t[r]=n[r](e);return t}}function a(t,e){for(var n=[],r=0,i=e.length;r<i;r++){var o=e[r];n[r]=p(0===r?t:e[r-1],o)}var s=e[e.length-1];n.push(p(s,s));var a=n.length-1;return function(t){var e=t*a,r=Math.floor(e),i=e-r;return(0,n[r])(i)}}function u(t,e,n){n=void 0!==n?n:1e4;for(var i=t.slice(),f=[],p=0,c=e.length;p<c;p++){var l=i[p],d=e[p];f[p]="string"==typeof d&&1===d.indexOf("=")?d:null,i[p]=l===d?null:m(d)?m(l)&&d.length===l.length?u(l,d,n):a(l,d):m(l)?s(l,d):"object"==typeof d?h(l,d,n):"string"==typeof d?o(l,d,n):l,e[p]=null!==f[p]?r(l,d):d}return function(o){for(var s=0,a=e.length;s<a;s++){var u=i[s],h=e[s],p=f[s];null!==u&&(t[s]="number"==typeof u?((u+(h-u)*o)*n|0)/n:"function"==typeof u?u(o):u.update?u.update(o):h,p&&1===o&&(i[s]=h,e[s]=r(i[s],p)))}return t}}function f(t,e,n){if(n=void 0!==n?n:1e4,2===e.length&&2===t.length&&-1!==T.indexOf(e[1])){var i=+t[0],o=+e[0],s=e[1],a="string"==typeof e[0]&&1===e[0].indexOf("=")?e[0]:null;return a&&(o=r(i,o)),function(t){var e=((i+(o-i)*t)*n|0)/n+s;return a&&1===t&&(o=r(i=o,a)),e}}return!1}function h(t,e,n){n=void 0!==n?n:1e4;var i={},f={};for(var p in e){f[p]=t[p];var c=f[p],l=e[p];i[p]="string"==typeof l&&1===l.indexOf("=")?l:null,f[p]=c===l?null:m(l)?m(c)&&l.length===c.length?u(c,l,n):a(c,l):m(c)?s(c,l):"object"==typeof l?h(c,l,n):"string"==typeof l?o(c,l,n):c,e[p]=null!==i[p]?r(c,l):l}return function(o){for(var s in e){var a=f[s],u=e[s],h=i[s];null!==a&&(t[s]="number"==typeof a?((a+(u-a)*o)*n|0)/n:"function"==typeof a?a(o):a.update?a.update(o):u,h&&1===o&&(f[s]=u,e[s]=r(f[s],h)))}return t}}function p(t,e,n){n=void 0!==n?n:1e4;var i="string"==typeof e&&"number"==typeof t&&1===e.indexOf("=")?e:null;return i&&(e=r(t,i)),m(e)?m(t)&&t.length===e.length?u(t,e,n):a(t,e):m(t)?s(t,e):"object"==typeof e?h(t,e,n):"string"==typeof e?o(t,e,n):"function"==typeof e?e:function(o){var s="number"==typeof e?((t+(e-t)*o)*n|0)/n:t;return i&&1===o&&(e=r(t+=e,i)),s}}var c=/rgb/g,l=/argb/g,d=/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,y=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,v=/\n|\r|\t/g,_=255,m=Array.isArray,g={"+=":1,"-=":1,"*=":2,"/=":3,"%=":4},b=function(t){return"string"!=typeof t?t:n(t).replace(y,e)},T=["px","pt","pc","deg","rad","turn","em","ex","cm","mm","dm","inch","in","rem","vw","vh","vmin","vmax","%"];return p})}),g={},b=function(t,e){return t?g[t]?e?Object.assign(g[t],e):g[t]:(g[t]=e,g[t]):e},T=function(){this._events={}};T.prototype.on=function(t,e){return this._events[t]||(this._events[t]=[]),this._events[t].push(e),this},T.prototype.once=function(t,e){var n=this;this._events[t]||(this._events[t]=[]);var r=this._events,i=r[t].length;return this._events[t].push(function(){for(var o=[],s=arguments.length;s--;)o[s]=arguments[s];e.apply(n,o),r[t].splice(i,1)}),this},T.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},T.prototype.emit=function(t,e,n,r,i){var o=this._events[t];if(!o||!o.length)return this;for(var s=0,a=o.length;s<a;s++)o[s](e,n,r,i)};var O=v.Linear.None,w=0,M=function(t){function e(e,n){return t.call(this),this.id=w++,void 0===e||n||e.nodeType?void 0!==e&&(this.node=e,"object"==typeof n?(n=this.object=b(e,n),this.object.node=e):this.object=n):(n=this.object=e,e=null),this._valuesEnd=null,this._duration=1e3,this._easingFunction=O,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._isFinite=!0,this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,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.pause=function(){return this._isPlaying?(this._isPlaying=!1,h(this),this._pausedTime=p(),this.emit("pause",this.object)):this},e.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=p()-this._pausedTime,u(this),this._pausedTime=p(),this.emit("play",this.object))},e.prototype.restart=function(t){return this._repeat=this._r,this._startTime=p()+(t?0:this._delayTime),this._isPlaying||u(this),this.emit("restart",this._object)},e.prototype.seek=function(t,e){return this._startTime=p()+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===e&&(e=1e3),this._valuesEnd=t,"number"==typeof e||"function"==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 e=this,n=e._valuesEnd,r=e.object,i=e.Renderer;if("object"==typeof n)for(var o in n)l[o]&&(n[o]=new l[o](t,r[o],n[o]));return this._valuesEnd=n=m(r,n),i&&this.node&&(this.__render=new i(this,n)),this},e.prototype.start=function(t){return this._startTime=void 0!==t?t:p(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,u(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?(h(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._isFinite=isFinite(t),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.reassignValues=function(){var t=this,e=t._valuesEnd,n=t.object;for(var r in e){var i=e[r];"number"!=typeof i&&"string"!=typeof i||(n[r]=i(0))}return this},e.prototype.get=function(t){return this.update(t),this.object},e.prototype.update=function(t,e){var n,r,i=this,o=i._onStartCallbackFired,s=i._easingFunction,a=i._repeat,u=i._repeatDelayTime,f=i._reverseDelayTime,c=i._yoyo,l=i._reversed,d=i._startTime,y=i._duration,v=i._valuesEnd,_=i.object,m=i._isFinite,g=i.__render;return(t=void 0!==t?t:p())<d||(o||(this._rendered||(this.render(),this.emit("start",_),this._rendered=!0),this._onStartCallbackFired=!0),n=(t-d)/y,n=n>1?1:n,n=l?1-n:n,r=s(n),_=v(r),g&&g.update(_,n),this.emit("update",_,r,n),!(1===n||l&&0===n)||(a?(m&&this._repeat--,c&&(this._reversed=!l),this._startTime=!l&&u?t+u:l&&f?t+f:t,!0):(e||h(this),this.emit("complete",_),this._repeat=this._r,!1)))},e}(T),j=function(){this.totalTime=0,this.labels=[],this.offsets=[]};j.prototype.parseLabel=function(t,e){var n=this,r=n.offsets,i=n.labels,o=i.indexOf(t);if("string"==typeof t&&-1!==t.indexOf("=")&&!e&&-1===o){var s=t.substr(t.indexOf("=")-1,2),a=t.split(s);e=2===a.length?s+a[1]:null,t=a[0],o=i.indexOf(t)}if(-1!==o&&t){var u=r[o]||0;if("number"==typeof e)u=e;else if("string"==typeof e&&-1!==e.indexOf("=")){var f=e.charAt(0);e=Number(e.substr(2)),"+"===f||"-"===f?u+=parseFloat(f+e):"*"===f?u*=e:"/"===f?u/=e:"%"===f&&(u*=e/100)}return u}return"number"==typeof e?e:0},j.prototype.addLabel=function(t,e){return this.labels.push(t),this.offsets.push(this.parseLabel(t,e)),this},j.prototype.setLabel=function(t,e){var n=this.labels.indexOf(t);return-1!==n&&this.offsets.splice(n,1,this.parseLabel(t,e)),this},j.prototype.eraseLabel=function(t){var e=this.labels.indexOf(t);return-1!==e&&(this.labels.splice(e,1),this.offsets.splice(e,1)),this};var I=0,x=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=p(),this._tweens={},this._elapsed=0,this._id=I++,this._defaultParams=e,this.position=new j,this.position.addLabel("afterLast",this._totalDuration),this.position.addLabel("afterInit",this._startTime),this}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.addLabel=function(t,e){return this.position.addLabel(t,e),this},e.prototype.map=function(t){var e=this;for(var n in e._tweens){var r=e._tweens[n];t(r,+n),e._totalDuration=Math.max(e._totalDuration,r._duration+r._startTime)}return this},e.prototype.add=function(e,n){var r=this;if(Array.isArray(e))return e.map(function(t){r.add(t,n)}),this;"object"!=typeof e||e instanceof t||(e=new t(e.from).to(e.to,e));var i=this,o=i._defaultParams,s=i._totalDuration;if(o)for(var a in o)e[a](o[a]);var u="number"==typeof n?n:this.position.parseLabel(void 0!==n?n:"afterLast",null);return e._startTime=this._startTime,e._startTime+=u,this._totalDuration=Math.max(s,e._startTime+e._delayTime+e._duration),this._tweens[e.id]=e,this.position.setLabel("afterLast",this._totalDuration),this},e.prototype.restart=function(){return this._startTime+=p(),u(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.reverse=function(){return this._reversed=!this._reversed,this.emit("reverse")},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,h=e._isFinite;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 c=t-s,l=a?r-c:c;for(var d in n){var y=n[d];if(y.skip)y.skip=!1;else{if(y.update(l))continue;y.skip=!0}}if(this.emit("update",p,c),1===p||a&&0===p){if(f){h&&this._repeat--,this.emit(a?"reverse":"repeat"),u&&this.reverse(),this._startTime+=!a&&i?r+i:a&&o?r+o:r;for(var v in n){var _=n[v];_.skip&&(_.skip=!1),_.reassignValues()}return!0}this.emit("complete"),this._repeat=this._r;for(var m in n){var g=n[m];g.skip&&(g.skip=!1)}return!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}(M);t.Plugins=l,t.Interpolator=m,t.has=function(t){return null!==f(t)},t.get=f,t.getAll=function(){return r},t.removeAll=function(){r.length=0,a(n)},t.remove=h,t.add=u,t.now=p,t.update=c,t.autoPlay=function(t){o=t},t.isRunning=function(){return i},t.Tween=M,t.Easing=v,t.Timeline=x,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=dist/Tween.min.js.map
//# sourceMappingURL=Tween.min.js.map
{
"name": "es6-tween",
"version": "3.3.0",
"version": "3.4.0",
"description": "ES6 implementation of amazing tween.js",

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

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

@@ -43,13 +43,15 @@ },

"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"
"eslint": "latest",
"eslint-plugin-import": "latest",
"rollup": "latest",
"rollup-plugin-buble": "latest",
"rollup-plugin-commonjs": "latest",
"rollup-plugin-node-resolve": "latest",
"rollup-plugin-uglify": "latest",
"rollup-watch": "latest",
"uglify-es": "latest"
},
"dependencies": {}
"dependencies": {
"intertween": "latest"
}
}
import buble from 'rollup-plugin-buble'
import uglify from 'rollup-plugin-uglify'
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import { minify } from 'uglify-es'

@@ -19,3 +21,9 @@

}
})
}),
nodeResolve({
main: true
}),
commonjs({
include: ['./node_modules/intertween/index.js']
})
]

@@ -39,2 +47,3 @@

sourceMap: true,
context: 'this',
dest: `dist/Tween${minSuffix}.js`,

@@ -41,0 +50,0 @@ moduleName: 'TWEEN',

@@ -1,20 +0,13 @@

/* global global, window, Object, document, process, requestAnimationFrame, cancelAnimationFrame, setTimeout, clearTimeout */
/* global process */
import { root } from '../shim'
let _tweens = {}
let _tweens = []
let isStarted = false
let _autoPlay = false
let _tick
let root = typeof (window) !== 'undefined' ? window : typeof (global) !== 'undefined' ? global : {}
let _nextId = 0
const _ticker = root.requestAnimationFrame
const _stopTicker = root.cancelAnimationFrame
let _ticker = fn => typeof (requestAnimationFrame) !== 'undefined' ? requestAnimationFrame(fn) : setTimeout(fn, 16.6)
let _stopTicker = fn => typeof (cancelAnimationFrame) !== 'undefined' ? cancelAnimationFrame(fn) : clearTimeout(fn)
let setProp = (o, p, param) => Object.defineProperty(o, p, param)
setProp(_tweens, 'length', {enumerable: false, writable: true, value: 0})
const add = tween => {
let {id} = tween
_tweens[id] = tween
_tweens.length++
_tweens.push(tween)

@@ -27,12 +20,4 @@ if (_autoPlay && !isStarted) {

const nextId = () => {
let id = _nextId
_nextId++
return id
}
const getAll = () => _tweens
const getAll = () => {
return _tweens
}
const autoPlay = (state) => {

@@ -43,6 +28,2 @@ _autoPlay = state

const removeAll = () => {
for (let id in _tweens) {
_tweens[id] = null
delete _tweens[id]
}
_tweens.length = 0

@@ -53,5 +34,5 @@ _stopTicker(_tick)

const get = tween => {
for (let searchTween in _tweens) {
if (tween.id === +searchTween) {
return _tweens[searchTween]
for (let i = 0; i < _tweens.length; i++) {
if (tween === _tweens[i]) {
return _tweens[i]
}

@@ -68,9 +49,7 @@ }

const remove = tween => {
for (let searchTween in _tweens) {
if (tween.id === +searchTween) {
delete _tweens[searchTween]
_tweens.length--
}
let i = _tweens.indexOf(tween)
if (i !== -1) {
_tweens.splice(i, 1)
}
if (_tweens.length === 0) {
if (!_tweens.length) {
_stopTicker(_tick)

@@ -108,5 +87,4 @@ }

let i
let length = _tweens.length
if (!length) {
const len = _tweens.length
if (!len) {
isStarted = false

@@ -117,3 +95,4 @@ _stopTicker(_tick)

for (i in _tweens) {
let i = 0
for (; i < len; i++) {
_tweens[i].update(time, preserve)

@@ -130,3 +109,3 @@ }

// Normalise time when visiblity is changed (if available) ...
if (root.document) {
if (root.document && root.document.addEventListener) {
let doc = root.document

@@ -143,4 +122,4 @@ let timeDiff = 0

for (let tween in _tweens) {
_tweens[tween]._startTime += timeDiff
for (let i = 0, length = _tweens.length; i < length; i++) {
_tweens[i]._startTime += timeDiff
}

@@ -155,2 +134,2 @@ _tick = _ticker(update)

export { Plugins, get, has, nextId, getAll, removeAll, remove, add, now, update, autoPlay, isRunning }
export { Plugins, get, has, getAll, removeAll, remove, add, now, update, autoPlay, isRunning }

@@ -48,9 +48,11 @@ export default class EventClass {

if (event === undefined || !_events[event]) {
let _event = _events[event]
if (!_event || !_event.length) {
return this
}
let _event = _events[event]
for (let i = 0, length = _event.length; i < length; i++) {
let i = 0
const len = _event.length
for (; i < len; i++) {
_event[i](arg1, arg2, arg3, arg4)

@@ -57,0 +59,0 @@ }

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

now,
nextId,
Plugins

@@ -11,4 +10,3 @@ }

import Easing from './Easing'
import Interpolation from './Interpolation'
import SubTween from './SubTween'
import InterTween from 'intertween'
import NodeCache from './NodeCache'

@@ -31,14 +29,10 @@ import EventClass from './Event'

let _id = 0 // Unique ID
class Tween extends EventClass {
timeout (fn, delay) {
return new Tween({x: 0}).to({x: 1}, delay).on('complete', fn)
}
interval (fn, delay) {
return new Tween({x: 0}).to({x: 1}, delay).repeat(Infinity).on('repeat', fn)
}
constructor (node, object) {
super()
this.id = nextId()
if (typeof node === 'object' && !object && !node.nodeType) {
this.id = _id++
if (typeof node !== 'undefined' && !object && !node.nodeType) {
object = this.object = node

@@ -48,11 +42,13 @@ node = null

this.node = node
object = this.object = NodeCache(node, object)
this.object.node = node
if (typeof object === 'object') {
object = this.object = NodeCache(node, object)
this.object.node = node
} else {
this.object = object
}
}
this._valuesStart = Tween.createEmptyConst(object)
this._valuesEnd = Tween.createEmptyConst(object)
this._valuesEnd = null
this._duration = 1000
this._easingFunction = defaultEasing
this._interpolationFunction = Interpolation.Linear

@@ -69,3 +65,2 @@ this._startTime = 0

this._pausedTime = null
this._plugins = {}
this._isFinite = true

@@ -76,11 +71,2 @@

static createEmptyConst (oldObject) {
return typeof (oldObject) === 'number' ? 0 : Array.isArray(oldObject) ? [] : typeof (oldObject) === 'object' ? {}
: ''
}
static checkValidness (valid) {
return valid !== undefined && valid !== null && valid !== '' && ((typeof valid === 'number' && !isNaN(valid)) || typeof valid !== 'number') && valid !== Infinity
}
isPlaying () {

@@ -161,8 +147,6 @@ return this._isPlaying

to (properties = {}, duration = 1000) {
if (typeof properties === 'object') {
this._valuesEnd = properties
}
to (properties, duration = 1000) {
this._valuesEnd = properties
if (typeof duration === 'number') {
if (typeof duration === 'number' || typeof (duration) === 'function') {
this._duration = typeof (duration) === 'function' ? duration(this._duration) : duration

@@ -186,37 +170,19 @@ } else if (typeof duration === 'object') {

let {
_valuesStart,
_valuesEnd,
object,
_plugins
Renderer
} = this
for (let property in _valuesEnd) {
let isPluginProp = Plugins[property]
if (isPluginProp) {
isPluginProp = _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] && typeof object[property] === 'object') {
_valuesEnd[property] = SubTween(object[property], _valuesEnd[property])
if (typeof _valuesEnd[property] === 'function') {
object[property] = _valuesEnd[property](0)
if (typeof _valuesEnd === 'object') {
for (let property in _valuesEnd) {
if (Plugins[property]) {
_valuesEnd[property] = new Plugins[property](this, object[property], _valuesEnd[property])
}
} else if (typeof _valuesEnd[property] === 'string' && typeof object[property] === 'string') {
_valuesEnd[property] = SubTween(object[property], _valuesEnd[property])
if (typeof _valuesEnd[property] === 'function') {
object[property] = _valuesEnd[property](0)
}
}
}
// If `to()` specifies a property that doesn't exist in the source object,
// we should not set that property in the object
if (Tween.checkValidness(object[property]) === false) {
continue
}
this._valuesEnd = _valuesEnd = InterTween(object, _valuesEnd)
_valuesStart[property] = object[property]
if (isPluginProp) {
isPluginProp.postprocess && isPluginProp.postprocess(object[property], _valuesEnd[property])
}
if (Renderer && this.node) {
this.__render = new Renderer(this, _valuesEnd)
}

@@ -307,11 +273,4 @@

interpolation (fn) {
this._interpolationFunction = fn
return this
}
reassignValues () {
const {
_valuesStart,
_valuesEnd,

@@ -323,6 +282,5 @@ object

let end = _valuesEnd[property]
let start = _valuesStart[property]
if (typeof end === 'number' || typeof end === 'string') {
object[property] = start
object[property] = end(0)
}

@@ -343,3 +301,2 @@ }

_easingFunction,
_interpolationFunction,
_repeat,

@@ -352,10 +309,8 @@ _repeatDelayTime,

_duration,
_valuesStart,
_valuesEnd,
_plugins,
object,
_isFinite
_isFinite,
__render
} = this
let property
let elapsed

@@ -386,32 +341,8 @@ let value

value = typeof _easingFunction === 'function' ? _easingFunction(elapsed) : defaultEasing(elapsed)
value = _easingFunction(elapsed)
for (property in _valuesEnd) {
let start = _valuesStart[property]
let end = _valuesEnd[property]
let plugin = _plugins[property]
value = _easingFunction[property] ? _easingFunction[property](elapsed) : value
object = _valuesEnd(value)
if (plugin && plugin.update) {
plugin.update(value, elapsed, _reversed)
} else if (start === null || start === undefined) {
continue
} else if (typeof end === 'function') {
object[property] = end(value)
} else if (Array.isArray(end)) {
object[property] = _interpolationFunction(end, value)
} else if (typeof (end) === 'number') {
object[property] = start + (end - start) * value
} else if (typeof (end) === 'string') {
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
end = start + parseFloat(end)
} else {
end = parseFloat(end)
}
// Protect against non numeric properties.
if (typeof (end) === 'number') {
object[property] = start + (end - start) * value
}
}
if (__render) {
__render.update(object, elapsed)
}

@@ -427,21 +358,12 @@

for (property in _valuesEnd) {
if (typeof (_valuesEnd[property]) === 'string' && typeof (_valuesStart[property]) === 'number') {
_valuesStart[property] = _valuesStart[property] + parseFloat(_valuesEnd[property])
}
}
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? EVENT_REVERSE : EVENT_REPEAT, object)
if (_yoyo) {
this.reverse()
this._reversed = !_reversed
}
if (!_reversed && _repeatDelayTime) {
this._startTime += _duration + _repeatDelayTime
this._startTime = time + _repeatDelayTime
} else if (_reversed && _reverseDelayTime) {
this._startTime += _duration + _reverseDelayTime
this._startTime = time + _reverseDelayTime
} else {
this._startTime += _duration
this._startTime = time
}

@@ -448,0 +370,0 @@

@@ -1,7 +0,7 @@

import { nextId, has, get, getAll, removeAll, remove, add, now, update, autoPlay, Plugins, isRunning } from './dist/core'
import './shim'
import { has, get, getAll, removeAll, remove, add, now, update, autoPlay, Plugins, isRunning } from './dist/core'
import Easing from './dist/Easing'
import Tween from './dist/Tween'
import Interpolation from './dist/Interpolation'
import Timeline from './dist/Timeline'
import SubTween from './dist/SubTween'
export { Plugins, SubTween as Interpolator, nextId, has, get, getAll, removeAll, remove, add, now, update, autoPlay, isRunning, Tween, Easing, Interpolation, Timeline }
import Interpolator from 'intertween'
export { Plugins, Interpolator, has, get, getAll, removeAll, remove, add, now, update, autoPlay, isRunning, Tween, Easing, Timeline }

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