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.5.1 to 2.5.2

.eslintrc

2281

dist/Tween.js

@@ -7,261 +7,210 @@ (function (global, factory) {

if (Object.assign === undefined) {
Object.assign = function (first) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
var bind = function (fn, ctx) {
return function () {
return fn.apply(ctx, arguments)
}
};
args.map(function (obj) {
for (var p in obj) {
first[p] = obj[p];
}
});
return first
};
}
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);
};
var ROOT = typeof (window) !== 'undefined' ? window : typeof (global) !== 'undefined' ? global : typeof exports !== 'undefined' ? exports : {};
var _vendor = ['webkit', 'moz', 'ms', 'o'];
var animFrame = 'AnimationFrame';
var rafSuffixForVendor = 'Request' + animFrame;
var cafSuffixForVendor = 'Cancel' + animFrame;
var cafSuffixForVendor2 = 'CancelRequest' + animFrame;
var _timeout = ROOT.setTimeout;
var _clearTimeout = ROOT.clearTimeout;
EventClass.prototype.bind = function bind (scope) {
this._bind = scope;
return this
};
if (_timeout && ROOT.requestAnimationFrame === undefined) {
var _raf;
var now;
var lastTime = Date.now();
var frameMs = (50 / 3);
var fpsSec = frameMs;
EventClass.prototype.on = function on (event, callback) {
if (!this._events[event]) {
this._events[event] = [];
}
_vendor.map(function (vendor) {
if ((_raf = ROOT[vendor + rafSuffixForVendor]) === undefined) {
_raf = function (fn) {
return _timeout(function () {
now = Date.now();
fn(now - lastTime);
fpsSec = frameMs + (Date.now() - now);
}, fpsSec)
};
}
});
this._events[event].push(callback);
return this
};
if (_raf !== undefined) {
ROOT.requestAnimationFrame = _raf;
EventClass.prototype.once = function once (event, callback) {
if (!this._events[event]) {
this._events[event] = [];
}
}
if (_clearTimeout && ROOT.cancelAnimationFrame === undefined && (ROOT.cancelAnimationFrame = ROOT.cancelRequestAnimationFrame) === undefined) {
var _caf;
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 ];
_vendor.map(function (vendor) {
if ((_caf = ROOT[vendor + cafSuffixForVendor]) === undefined && (_caf = ROOT[vendor + cafSuffixForVendor2]) === undefined) {
_caf = function (fn) {
return _clearTimeout(fn)
};
}
callback.apply(_bind, args);
_events[event].splice(spliceIndex, 1);
});
return this
};
if (_caf !== undefined) {
ROOT.cancelAnimationFrame = _caf;
EventClass.prototype.off = function off (event, callback) {
var ref = this;
var _events = ref._events;
if (event === undefined || !_events[event]) {
return this
}
}
if (Array.isArray === undefined) {
Array.isArray = function (arrayLike) {
return arrayLike !== undefined && typeof arrayLike === 'object' && arrayLike.length && arrayLike.push !== undefined && arrayLike.splice !== undefined
};
}
if (callback) {
this._events[event] = this._events[event].filter(function (cb) { return cb !== callback; });
} else {
this._events[event].length = 0;
}
var _tweens = {};
var isStarted = false;
var _autoPlay = false;
var _tick;
var _events = {};
var root = typeof (window) !== "undefined" ? window : typeof (global) !== "undefined" ? global : {};
var _nextId = 0;
return this
};
Object.defineProperty(_tweens, "length", {
enumerable: false,
writable: true,
value: 0
});
EventClass.prototype.emit = function emit (event, arg1, arg2, arg3, arg4) {
var ref = this;
var _events = ref._events;
var _bind = ref._bind;
var emit = function(name, a, b, c, d, e) {
var this$1 = this;
if (event === undefined || !_events[event]) {
return this
}
var eventFn = _events[name];
var _event = _events[event];
if (eventFn) {
var i = eventFn.length;
while (i--) {
eventFn[i].call(this$1, a, b, c, d, e);
}
}
for (var i = 0, length = _event.length; i < length; i++) {
_event[i].call(_bind, arg1, arg2, arg3, arg4);
}
};
var on = function (ev, fn) {
if (_events[ev] === undefined) {
_events[ev] = [];
}
_events[ev].push(fn);
};
/* global global, window, Object, document, process, requestAnimationFrame, cancelAnimationFrame, setTimeout, clearTimeout */
var _tweens = {};
var isStarted = false;
var _autoPlay = 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 : {};
var _nextId = 0;
var once = function (ev, fn) {
if (_events[ev] === undefined) {
_events[ev] = [];
}
on(ev, function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
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); };
fn.apply(void 0, args);
off(ev);
});
};
var setProp = function (o, p, param) { return Object.defineProperty(o, p, param); };
setProp(_tweens, 'length', {enumerable: false, writable: true, value: 0});
var off = function (ev, fn) {
if (ev === undefined || _events[ev] === undefined) {
return;
}
if (fn !== undefined) {
var eventsList = _events[name]
, i = 0;
while (i < eventsList.length) {
if (eventsList[i] === fn) {
eventsList.splice(i, 1);
}
i++;
}
} else {
_events[name] = [];
}
};
var add = function (tween) {
var id = tween.id;
_tweens[id] = tween;
_tweens.length++;
var add$1 = function (tween) {
var id = tween.id;
_tweens[id] = tween;
_tweens.length++;
if (_autoPlay && !isStarted) {
update();
isStarted = true;
emit('start');
}
if (_autoPlay && !isStarted) {
update();
isStarted = true;
emit('start');
}
emit('add', tween, _tweens);
emit('add', tween, _tweens);
};
var nextId = function () {
var id = _nextId;
_nextId++;
return id;
var id = _nextId;
_nextId++;
return id
};
var getAll = function () {
return _tweens;
return _tweens
};
var autoPlay = function (state) {
_autoPlay = state;
_autoPlay = state;
};
var removeAll = function () {
_tweens = {};
Object.defineProperty(_tweens, "length", {
enumerable: false,
writable: true,
value: 0
});
for (var id in _tweens) {
_tweens[+id] = null;
delete _tweens[+id];
}
_tweens.length = 0;
};
var get = function (tween) {
for (var searchTween in _tweens) {
if (tween.id === +searchTween) {
return _tweens[+searchTween]
}
}
for ( var searchTween in _tweens ) {
if (tween.id === +searchTween) {
return _tweens[+searchTween];
}
}
return null;
return null
};
var has = function (tween) {
return get(tween) !== null;
return get(tween) !== null
};
var remove = function (tween) {
for ( var searchTween in _tweens ) {
if (tween.id === +searchTween) {
delete _tweens[+searchTween];
_tweens.length--;
}
}
for (var searchTween in _tweens) {
if (tween.id === +searchTween) {
delete _tweens[+searchTween];
_tweens.length--;
}
}
};
var now$1 = function () {
if (typeof (process) !== "undefined" && process.hrtime !== undefined) {
return function () {
var time = process.hrtime();
var now = (function () {
if (typeof (process) !== 'undefined' && process.hrtime !== undefined) {
return function () {
var time = process.hrtime();
// Convert [seconds, nanoseconds] to milliseconds.
return time[0] * 1000 + time[1] / 1000000;
};
}
// In a browser, use window.performance.now if it is available.
else if (root.performance !== undefined &&
root.performance.now !== undefined) {
// Convert [seconds, nanoseconds] to milliseconds.
return time[0] * 1000 + time[1] / 1000000
}
// In a browser, use window.performance.now if it is available.
} else if (root.performance !== undefined &&
root.performance.now !== undefined) {
// This must be bound, because directly assigning this function
// leads to an invocation exception in Chrome.
return root.performance.now.bind(root.performance)
// Use Date.now if it is available.
} else {
var offset = root.performance && root.performance.timing && root.performance.timing.navigationStart ? root.performance.timing.navigationStart : Date.now();
return function () {
return Date.now() - offset
}
}
}());
// This must be bound, because directly assigning this function
// leads to an invocation exception in Chrome.
return root.performance.now.bind(root.performance)
}
// Use Date.now if it is available.
else {
var offset = root.performance && root.performance.timing && root.performance.timing.navigationStart ? root.performance.timing.navigationStart : Date.now();
return function () {
return Date.now() - offset;
}
}
}();
var update = function (time, preserve) {
time = time !== undefined ? time : now();
time = time !== undefined ? time : now$1();
if (_autoPlay) {
_tick = _ticker(update);
}
if (_autoPlay) {
_tick = requestAnimationFrame(update);
}
emit('update', time, _tweens);
emit('update', time, _tweens);
if (_tweens.length === 0) {
if (_tweens.length === 0) {
isStarted = false;
_stopTicker(_tick);
emit('stop', time);
return false
}
isStarted = false;
cancelAnimationFrame(_tick);
emit('stop', time);
return false;
for (var i in _tweens) {
if (_tweens[i].update(time) || preserve) {
i++;
} else {
delete _tweens[+i];
_tweens.length--;
}
}
}
for ( var i in _tweens ) {
if (_tweens[i].update(time) || preserve) {
i++;
} else {
delete _tweens[+i];
_tweens.length--;
}
}
return true;
return true
};

@@ -271,21 +220,22 @@

if (root.document) {
var doc = root.document, timeDiff = 0, timePause = 0;
doc.addEventListener('visibilitychange', function (ev) {
if (_tweens.length === 0) {
return false;
}
if (document.hidden) {
timePause = now$1();
} else {
timeDiff = now$1() - timePause;
var doc = root.document;
var timeDiff = 0;
var timePause = 0;
doc.addEventListener('visibilitychange', function () {
if (_tweens.length === 0) {
return false
}
for ( var tween in _tweens ) {
if (document.hidden) {
timePause = now();
} else {
timeDiff = now() - timePause;
_tweens[tween]._startTime += timeDiff;
for (var tween in _tweens) {
_tweens[tween]._startTime += timeDiff;
}
}
}
}
return true;
});
return true
});
}

@@ -295,316 +245,254 @@

Linear: {
Linear: {
None: function None(k) {
None: function None (k) {
return k
}
return k;
},
}
Quadratic: {
},
In: function In (k) {
return k * k
},
Quadratic: {
Out: function Out (k) {
return k * (2 - k)
},
In: function In(k) {
InOut: function InOut (k) {
if ((k *= 2) < 1) {
return 0.5 * k * k
}
return k * k;
return -0.5 * (--k * (k - 2) - 1)
}
},
},
Out: function Out(k) {
Cubic: {
return k * (2 - k);
In: function In (k) {
return k * k * k
},
},
Out: function Out (k) {
return --k * k * k + 1
},
InOut: function InOut(k) {
InOut: function InOut (k) {
if ((k *= 2) < 1) {
return 0.5 * k * k * k
}
if ((k *= 2) < 1) {
return 0.5 * k * k;
}
return 0.5 * ((k -= 2) * k * k + 2)
}
return - 0.5 * (--k * (k - 2) - 1);
},
}
Quartic: {
},
In: function In (k) {
return k * k * k * k
},
Cubic: {
Out: function Out (k) {
return 1 - (--k * k * k * k)
},
In: function In(k) {
InOut: function InOut (k) {
if ((k *= 2) < 1) {
return 0.5 * k * k * k * k
}
return k * k * k;
return -0.5 * ((k -= 2) * k * k * k - 2)
}
},
},
Out: function Out(k) {
Quintic: {
return --k * k * k + 1;
In: function In (k) {
return k * k * k * k * k
},
},
Out: function Out (k) {
return --k * k * k * k * k + 1
},
InOut: function InOut(k) {
InOut: function InOut (k) {
if ((k *= 2) < 1) {
return 0.5 * k * k * k * k * k
}
if ((k *= 2) < 1) {
return 0.5 * k * k * k;
}
return 0.5 * ((k -= 2) * k * k * k * k + 2)
}
return 0.5 * ((k -= 2) * k * k + 2);
},
}
Sinusoidal: {
},
In: function In (k) {
return 1 - Math.cos(k * Math.PI / 2)
},
Quartic: {
Out: function Out (k) {
return Math.sin(k * Math.PI / 2)
},
In: function In(k) {
InOut: function InOut (k) {
return 0.5 * (1 - Math.cos(Math.PI * k))
}
return k * k * k * k;
},
},
Exponential: {
Out: function Out(k) {
In: function In (k) {
return k === 0 ? 0 : Math.pow(1024, k - 1)
},
return 1 - (--k * k * k * k);
Out: function Out (k) {
return k === 1 ? 1 : 1 - Math.pow(2, -10 * k)
},
},
InOut: function InOut (k) {
if (k === 0) {
return 0
}
InOut: function InOut(k) {
if (k === 1) {
return 1
}
if ((k *= 2) < 1) {
return 0.5 * k * k * k * k;
}
if ((k *= 2) < 1) {
return 0.5 * Math.pow(1024, k - 1)
}
return - 0.5 * ((k -= 2) * k * k * k - 2);
return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2)
}
}
},
},
Circular: {
Quintic: {
In: function In (k) {
return 1 - Math.sqrt(1 - k * k)
},
In: function In(k) {
Out: function Out (k) {
return Math.sqrt(1 - (--k * k))
},
return k * k * k * k * k;
InOut: function InOut (k) {
if ((k *= 2) < 1) {
return -0.5 * (Math.sqrt(1 - k * k) - 1)
}
},
return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1)
}
Out: function Out(k) {
},
return --k * k * k * k * k + 1;
Elastic: {
},
In: function In (k) {
if (k === 0) {
return 0
}
InOut: function InOut(k) {
if (k === 1) {
return 1
}
if ((k *= 2) < 1) {
return 0.5 * k * k * k * k * k;
}
return -Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI)
},
return 0.5 * ((k -= 2) * k * k * k * k + 2);
Out: function Out (k) {
if (k === 0) {
return 0
}
}
if (k === 1) {
return 1
}
},
return Math.pow(2, -10 * k) * Math.sin((k - 0.1) * 5 * Math.PI) + 1
},
Sinusoidal: {
InOut: function InOut (k) {
if (k === 0) {
return 0
}
In: function In(k) {
if (k === 1) {
return 1
}
return 1 - Math.cos(k * Math.PI / 2);
k *= 2;
},
if (k < 1) {
return -0.5 * Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI)
}
Out: function Out(k) {
return 0.5 * Math.pow(2, -10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) + 1
}
return Math.sin(k * Math.PI / 2);
},
},
Back: {
InOut: function InOut(k) {
In: function In (k) {
var s = 1.70158;
return 0.5 * (1 - Math.cos(Math.PI * k));
return k * k * ((s + 1) * k - s)
},
}
Out: function Out (k) {
var s = 1.70158;
},
return --k * k * ((s + 1) * k + s) + 1
},
Exponential: {
InOut: function InOut (k) {
var s = 1.70158 * 1.525;
In: function In(k) {
if ((k *= 2) < 1) {
return 0.5 * (k * k * ((s + 1) * k - s))
}
return k === 0 ? 0 : Math.pow(1024, k - 1);
return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2)
}
},
},
Out: function Out(k) {
Bounce: {
return k === 1 ? 1 : 1 - Math.pow(2, - 10 * k);
In: function In (k) {
return 1 - Easing.Bounce.Out(1 - k)
},
},
Out: function Out (k) {
if (k < (1 / 2.75)) {
return 7.5625 * k * k
} else if (k < (2 / 2.75)) {
return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75
} else if (k < (2.5 / 2.75)) {
return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375
} else {
return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375
}
},
InOut: function InOut(k) {
InOut: function InOut (k) {
if (k < 0.5) {
return Easing.Bounce.In(k * 2) * 0.5
}
if (k === 0) {
return 0;
}
return Easing.Bounce.Out(k * 2 - 1) * 0.5 + 0.5
}
if (k === 1) {
return 1;
}
}
if ((k *= 2) < 1) {
return 0.5 * Math.pow(1024, k - 1);
}
return 0.5 * (- Math.pow(2, - 10 * (k - 1)) + 2);
}
},
Circular: {
In: function In(k) {
return 1 - Math.sqrt(1 - k * k);
},
Out: function Out(k) {
return Math.sqrt(1 - (--k * k));
},
InOut: function InOut(k) {
if ((k *= 2) < 1) {
return - 0.5 * (Math.sqrt(1 - k * k) - 1);
}
return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
}
},
Elastic: {
In: function In(k) {
if (k === 0) {
return 0;
}
if (k === 1) {
return 1;
}
return -Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI);
},
Out: function Out(k) {
if (k === 0) {
return 0;
}
if (k === 1) {
return 1;
}
return Math.pow(2, -10 * k) * Math.sin((k - 0.1) * 5 * Math.PI) + 1;
},
InOut: function InOut(k) {
if (k === 0) {
return 0;
}
if (k === 1) {
return 1;
}
k *= 2;
if (k < 1) {
return -0.5 * Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI);
}
return 0.5 * Math.pow(2, -10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) + 1;
}
},
Back: {
In: function In(k) {
var s = 1.70158;
return k * k * ((s + 1) * k - s);
},
Out: function Out(k) {
var s = 1.70158;
return --k * k * ((s + 1) * k + s) + 1;
},
InOut: function InOut(k) {
var s = 1.70158 * 1.525;
if ((k *= 2) < 1) {
return 0.5 * (k * k * ((s + 1) * k - s));
}
return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
}
},
Bounce: {
In: function In(k) {
return 1 - Easing.Bounce.Out(1 - k);
},
Out: function Out(k) {
if (k < (1 / 2.75)) {
return 7.5625 * k * k;
} else if (k < (2 / 2.75)) {
return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
} else if (k < (2.5 / 2.75)) {
return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
} else {
return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
}
},
InOut: function InOut(k) {
if (k < 0.5) {
return Easing.Bounce.In(k * 2) * 0.5;
}
return Easing.Bounce.Out(k * 2 - 1) * 0.5 + 0.5;
}
}
};

@@ -614,124 +502,104 @@

Linear: function Linear(v, k) {
Linear: function Linear (v, k) {
var m = v.length - 1;
var f = m * k;
var i = Math.floor(f);
var fn = Interpolation.Utils.Linear;
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 < 0) {
return fn(v[0], v[1], f);
}
if (k > 1) {
return fn(v[m], v[m - 1], m - 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)
},
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;
},
for (var i = 0; i <= n; i++) {
b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
}
Bezier: function Bezier(v, k) {
return b
},
var b = 0;
var n = v.length - 1;
var pw = Math.pow;
var bn = Interpolation.Utils.Bernstein;
CatmullRom: function CatmullRom (v, k) {
var m = v.length - 1;
var f = m * k;
var i = Math.floor(f);
var fn = Interpolation.Utils.CatmullRom;
for (var i = 0; i <= n; i++) {
b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
}
if (v[0] === v[m]) {
if (k < 0) {
i = Math.floor(f = m * (1 + k));
}
return b;
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i)
} 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])
}
CatmullRom: function CatmullRom(v, k) {
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)
}
},
var m = v.length - 1;
var f = m * k;
var i = Math.floor(f);
var fn = Interpolation.Utils.CatmullRom;
Utils: {
if (v[0] === v[m]) {
Linear: function Linear (p0, p1, t) {
return (p1 - p0) * t + p0
},
if (k < 0) {
i = Math.floor(f = m * (1 + k));
}
Bernstein: function Bernstein (n, i) {
var fc = Interpolation.Utils.Factorial;
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
return fc(n) / fc(i) / fc(n - i)
},
} else {
Factorial: (function () {
var a = [1];
if (k < 0) {
return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);
}
return function (n) {
var s = 1;
if (k > 1) {
return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
}
if (a[n]) {
return a[n]
}
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);
for (var i = n; i > 1; i--) {
s *= i;
}
}
a[n] = s;
return s
}
})(),
},
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;
Utils: {
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1
}
Linear: function Linear(p0, p1, t) {
}
return (p1 - p0) * t + p0;
},
Bernstein: function Bernstein(n, i) {
var fc = Interpolation.Utils.Factorial;
return fc(n) / fc(i) / fc(n - i);
},
Factorial: (function() {
var a = [1];
return function (n) {
var s = 1;
if (a[n]) {
return a[n];
}
for (var i = n; i > 1; i--) {
s *= i;
}
a[n] = s;
return s;
};
})(),
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;
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (- 3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
}
}
};
function toNumber(val) {
var floatedVal = parseFloat(val);
return typeof floatedVal === "number" && !isNaN(floatedVal) ? floatedVal : val;
function toNumber (val) {
var floatedVal = parseFloat(val);
return typeof floatedVal === 'number' && !isNaN(floatedVal) ? floatedVal : val
}

@@ -745,302 +613,258 @@

// Optimized, Extended by @dalisoft
var Number_Match_RegEx =
/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi;
var numRegExp =
/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
var hexColor = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i;
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 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 SubTween = function (start, end, roundv) {
if ( roundv === void 0 ) roundv = 10000;
if ( roundv === void 0 ) roundv = 10000;
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] : 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, length = end.length; i < length; i++ ) {
var 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 (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]) : SubTween(start[i], v); });
var endIndex = startIndex !== null ? startIndex + 6 : null;
if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {
startIndex++;
endIndex++;
}
if (startIndex !== null && i > startIndex && i < endIndex) {
map[i] = map[i] | 0;
}
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;
}
}
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] === "string" ) {
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;
}
}
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") {
var _startMap = start.replace(hexColor, hexReplace).match(Number_Match_RegEx).map(toNumber);
var _endMap = end.replace(hexColor, hexReplace).match(Number_Match_RegEx).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 s
}
} else if (typeof end === "function") {
return end;
} else {
var isSame$1 = start === end;
return function (t) { return isSame$1 ? start : t >= 0.5 ? end : start; };
}
};
if (startIndex !== null && i > startIndex && i < endIndex) {
map[i] = map[i] | 0;
}
}
}
var Store = {
add: function (tween) {
if (Store[tween] && JSON.stringify(tween) && JSON.stringify(Store[tween])) {
return Store[tween];
}
Store[tween] = tween;
return tween
}
};
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] === 'string') {
end[property] = SubTween(start[property], end[property]);
}
}
var maxDecNum = 10000;
var defaultEasing = Easing.Linear.None;
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;
}
}
var Tween = function Tween(object, instate) {
if ( object === void 0 ) object = {};
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') {
var _startMap = start.replace(hexColor, hexReplace).match(numRegExp).map(toNumber);
var _endMap = 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 s
}
} else if (typeof end === 'function') {
return end
} else {
var isSame$1 = start === end;
return function (t) { return isSame$1 ? start : t >= 0.5 ? end : start; }
}
};
this.isJoinToString = typeof object === "string";
this.object = object;
this._valuesStart = Tween.createEmptyConst(object);
this._valuesEnd = Tween.createEmptyConst(object);
var Store = {
add: function (tween) {
if (Store[tween] && JSON.stringify(tween) && JSON.stringify(Store[tween])) {
return Store[tween]
}
this._duration = 1000;
this._easingFunction = defaultEasing;
this._interpolationFunction = Interpolation.None;
Store[tween] = tween;
return tween
}
};
this._startTime = 0;
this._delayTime = 0;
this._repeat = 0;
this._r = 0;
this._isPlaying = false;
this._yoyo = false;
this._reversed = false;
var defaultEasing = Easing.Linear.None;
this._onStartCallbackFired = false;
this._pausedTime = null;
this.id = nextId();
// Events list
var EVENT_UPDATE = 'update';
var EVENT_COMPLETE = 'complete';
var EVENT_START = 'start';
var EVENT_REPEAT = 'repeat';
var EVENT_REVERSE = 'reverse';
var EVENT_PAUSE = 'pause';
var EVENT_PLAY = 'play';
var EVENT_RS = 'restart';
var EVENT_STOP = 'stop';
var EVENT_SEEK = 'seek';
if (instate && instate.to) {
var Tween = (function (EventClass$$1) {
function Tween (object, instate) {
if ( object === void 0 ) object = {};
return new Tween(object)
.to(instate.to, instate);
EventClass$$1.call(this);
}
this.isJoinToString = typeof object === 'string';
this.object = object;
this._valuesStart = Tween.createEmptyConst(object);
this._valuesEnd = Tween.createEmptyConst(object);
return this;
this._duration = 1000;
this._easingFunction = defaultEasing;
this._interpolationFunction = Interpolation.None;
};
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 !== '' && valid !== NaN && valid !== Infinity;
};
Tween.prototype.isPlaying = function isPlaying () {
return this._isPlaying;
};
Tween.prototype.isStarted = function isStarted () {
return this._onStartCallbackFired;
};
Tween.prototype.reverse = function reverse () {
this._startTime = 0;
this._delayTime = 0;
this._repeat = 0;
this._r = 0;
this._isPlaying = false;
this._yoyo = false;
this._reversed = false;
var ref = this;
var _reversed = ref._reversed;
this._onStartCallbackFired = false;
this._pausedTime = null;
this.id = nextId();
this._reversed = !_reversed;
return this;
};
Tween.prototype.reversed = function reversed () {
return this._reversed;
};
Tween.prototype.useActiveMode = function useActiveMode () {
this.object = Store.add(this.object);
return this;
};
Tween.prototype.off = function off$$1 (name, fn) {
if (!(this._events && this._events[name] !== undefined)) {
return this;
}
if (name !== undefined && fn !== undefined) {
var eventsList = this._events[name],
i = 0;
while (i < eventsList.length) {
if (eventsList[i] === fn) {
eventsList.splice(i, 1);
}
i++;
if (instate && instate.to) {
return new Tween(object)
.to(instate.to, instate)
}
} else if (name !== undefined && fn === undefined) {
this._events[name] = [];
}
return this;
};
Tween.prototype.on = function on$$1 (name, fn) {
if (!(this._events && this._events[name] !== undefined)) {
if (!this._events) {
this._events = {};
}
this._events[name] = [];
}
this._events[name].push(fn);
return this;
};
Tween.prototype.once = function once$$1 (name, fn) {
var this$1 = this;
if (!(this._events && this._events[name] !== undefined)) {
if (!this._events) {
this._events = {};
}
this._events[name] = [];
return this
}
return this.on(name, function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
fn.call.apply(fn, [ this$1 ].concat( args ));
this$1.off(name);
});
};
Tween.prototype.emit = function emit$$1 (name, a, b, c, d, e) {
var this$1 = this;
if ( EventClass$$1 ) Tween.__proto__ = EventClass$$1;
Tween.prototype = Object.create( EventClass$$1 && EventClass$$1.prototype );
Tween.prototype.constructor = Tween;
Tween.createEmptyConst = function createEmptyConst (oldObject) {
return typeof (oldObject) === 'number' ? 0 : Array.isArray(oldObject) ? [] : typeof (oldObject) === 'object' ? {}
: ''
};
var ref = this;
var _events = ref._events;
Tween.checkValidness = function checkValidness (valid) {
return valid !== undefined && valid !== null && valid !== '' && ((typeof valid === 'number' && !isNaN(valid)) || typeof valid !== 'number') && valid !== Infinity
};
if (!_events) {
return this;
}
Tween.prototype.isPlaying = function isPlaying () {
return this._isPlaying
};
var eventFn = _events[name];
Tween.prototype.isStarted = function isStarted () {
return this._onStartCallbackFired
};
if (!eventFn) {
return this;
}
Tween.prototype.reverse = function reverse () {
var ref = this;
var _reversed = ref._reversed;
var i = eventFn.length;
while (i--) {
eventFn[i].call(this$1, a, b, c, d, e);
}
return this;
this._reversed = !_reversed;
};
Tween.prototype.pause = function pause () {
return this
};
if (!this._isPlaying) {
return this;
}
Tween.prototype.reversed = function reversed () {
return this._reversed
};
this._isPlaying = false;
Tween.prototype.useActiveMode = function useActiveMode () {
this.object = Store.add(this.object);
return this
};
remove(this);
this._pausedTime = now$1();
Tween.prototype.pause = function pause () {
if (!this._isPlaying) {
return this
}
return this.emit('pause', this.object);
};
Tween.prototype.play = function play () {
this._isPlaying = false;
if (this._isPlaying) {
return this;
}
remove(this);
this._pausedTime = now();
this._isPlaying = true;
return this.emit(EVENT_PAUSE, this.object)
};
this._startTime += now$1() - this._pausedTime;
add$1(this);
this._pausedTime = now$1();
Tween.prototype.play = function play () {
if (this._isPlaying) {
return this
}
return this.emit('play', this.object);
};
Tween.prototype.restart = function restart (noDelay) {
this._isPlaying = true;
this._repeat = this._r;
this._startTime = now$1() + (noDelay ? 0 : this._delayTime);
this._startTime += now() - this._pausedTime;
add(this);
this._pausedTime = now();
if (!this._isPlaying) {
add$1(this);
}
return this.emit(EVENT_PLAY, this.object)
};
return this.emit('restart', this._object);
Tween.prototype.restart = function restart (noDelay) {
this._repeat = this._r;
this._startTime = now() + (noDelay ? 0 : this._delayTime);
};
Tween.prototype.seek = function seek (time, keepPlaying) {
if (!this._isPlaying) {
add(this);
}
this._startTime = now$1() + Math.max(0, Math.min(
time, this._duration));
return this.emit(EVENT_RS, this._object)
};
this.emit('seek', time, this._object);
Tween.prototype.seek = function seek (time, keepPlaying) {
this._startTime = now() + Math.max(0, Math.min(
time, this._duration));
return keepPlaying ? this : this.pause();
this.emit(EVENT_SEEK, time, this._object);
};
Tween.prototype.duration = function duration (amount) {
return keepPlaying ? this : this.pause()
};
this._duration = typeof(amount) === "function" ? amount(this._duration) : amount;
Tween.prototype.duration = function duration (amount) {
this._duration = typeof (amount) === 'function' ? amount(this._duration) : amount;
return this;
};
Tween.prototype.to = function to (properties, duration) {
return this
};
Tween.prototype.to = function to (properties, duration) {
var this$1 = this;

@@ -1050,53 +874,38 @@ if ( properties === void 0 ) properties = {};

if (typeof properties === 'object') {
this._valuesEnd = properties;
}
if (typeof properties === "number") {
var _vE = {
Number: properties
};
this._valuesEnd = _vE;
} else if (typeof properties === "string" && this.isJoinToString) {
this._valuesEnd = SubTween(this.object, properties);
} else {
this._valuesEnd = properties;
}
if (typeof duration === "number") {
this._duration = typeof(duration) === "function" ? duration(this._duration) : duration;
} else if (typeof duration === "object") {
for (var prop in duration) {
if (this$1[prop]) {
(ref = this$1)[prop].apply(ref, (Array.isArray(duration) ? duration : [duration]));
if (typeof duration === 'number') {
this._duration = typeof (duration) === 'function' ? duration(this._duration) : duration;
} else if (typeof duration === 'object') {
for (var prop in duration) {
if (this$1[prop]) {
(ref = this$1)[prop].apply(ref, (Array.isArray(duration) ? duration : [duration]));
}
}
}
}
return this;
return this
var ref;
};
};
Tween.prototype.render = function render () {
Tween.prototype.render = function render () {
var this$1 = this;
if (this._rendered) {
return this
}
var ref = this;
var _startTime = ref._startTime;
var _delayTime = ref._delayTime;
var ref = this;
var _valuesEnd = ref._valuesEnd;
var _valuesStart = ref._valuesStart;
var object = ref.object;
if (typeof _valuesEnd === "object") {
for (var property in _valuesEnd) {
if (typeof _valuesEnd[property] === "object" && _valuesEnd[property]) {
if (typeof _valuesEnd[property] === 'object' && _valuesEnd[property]) {
this$1._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
this$1.object[property] = this$1._valuesEnd[property](0);
} else if (typeof _valuesEnd[property] === "string" && typeof object[property] === "string") {
this$1.object[property] = this$1._valuesEnd[property](0);
} else if (typeof _valuesEnd[property] === 'string' && typeof object[property] === 'string') {
this$1._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
this$1.object[property] = this$1._valuesEnd[property](0);
this$1.object[property] = this$1._valuesEnd[property](0);
}

@@ -1107,3 +916,3 @@

if (Tween.checkValidness(object[property]) === false) {
continue;
continue
}

@@ -1114,114 +923,103 @@

if (object[property] === _valuesEnd[property]) {
continue;
continue
}
this$1._valuesStart[property] = object[property];
}
}
return this
};
};
Tween.prototype.start = function start (time) {
Tween.prototype.start = function start (time) {
this._startTime = time !== undefined ? time : now();
this._startTime += this._delayTime;
this._startTime = time !== undefined ? time : now$1();
this._startTime += this._delayTime;
this.render();
this._rendered = true;
this.render();
this._rendered = true;
add(this);
add$1(this);
this.emit(EVENT_START, this.object);
this.emit('start', this.object);
this._isPlaying = true;
this._isPlaying = true;
return this
};
return this;
};
Tween.prototype.stop = function stop () {
var ref = this;
Tween.prototype.stop = function stop () {
var ref = this;
var _isPlaying = ref._isPlaying;
var object = ref.object;
if (!_isPlaying) {
return this;
}
if (!_isPlaying) {
return this
}
remove(this);
this._isPlaying = false;
remove(this);
this._isPlaying = false;
return this.emit('stop', object);
return this.emit(EVENT_STOP, object)
};
};
Tween.prototype.end = function end () {
var ref = this;
Tween.prototype.end = function end () {
var ref = this;
var _startTime = ref._startTime;
var _duration = ref._duration;
return this.update(_startTime + _duration);
return this.update(_startTime + _duration)
};
};
Tween.prototype.delay = function delay (amount) {
Tween.prototype.delay = function delay (amount) {
this._delayTime = typeof (amount) === 'function' ? amount(this._delayTime) : amount;
this._startTime += this._delayTime;
this._delayTime = typeof(amount) === "function" ? amount(this._delayTime) : amount;
this._startTime += this._delayTime;
return this
};
return this;
Tween.prototype.repeat = function repeat (amount) {
this._repeat = typeof (amount) === 'function' ? amount(this._repeat) : amount;
this._r = this._repeat;
};
Tween.prototype.repeat = function repeat (amount) {
return this
};
this._repeat = typeof(amount) === "function" ? amount(this._repeat) : amount;
this._r = this._repeat;
Tween.prototype.repeatDelay = function repeatDelay (amount) {
this._repeatDelayTime = typeof (amount) === 'function' ? amount(this._repeatDelayTime) : amount;
return this;
return this
};
};
Tween.prototype.repeatDelay = function repeatDelay (amount) {
Tween.prototype.reverseDelay = function reverseDelay (amount) {
this._reverseDelayTime = typeof (amount) === 'function' ? amount(this._reverseDelayTime) : amount;
this._repeatDelayTime = typeof(amount) === "function" ? amount(this._repeatDelayTime) : amount;
return this
};
return this;
Tween.prototype.yoyo = function yoyo (state) {
this._yoyo = typeof (state) === 'function' ? state(this._yoyo) : state;
};
Tween.prototype.reverseDelay = function reverseDelay (amount) {
return this
};
this._reverseDelayTime = typeof(amount) === "function" ? amount(this._reverseDelayTime) : amount;
Tween.prototype.easing = function easing (fn) {
this._easingFunction = fn;
return this;
return this
};
};
Tween.prototype.yoyo = function yoyo (state) {
Tween.prototype.interpolation = function interpolation (fn) {
this._interpolationFunction = fn;
this._yoyo = typeof(state) === "function" ? state(this._yoyo) : state;
return this
};
return this;
Tween.prototype.get = function get$$1 (time) {
this.update(time);
return this.object
};
};
Tween.prototype.easing = function easing (fn) {
this._easingFunction = fn;
return this;
};
Tween.prototype.interpolation = function interpolation (fn) {
this._interpolationFunction = fn;
return this;
};
Tween.prototype.get = function get$$1 (time) {
this.update(time);
return this.object;
};
Tween.prototype.update = function update$$1 (time) {
Tween.prototype.update = function update$$1 (time) {
var this$1 = this;
var ref = this;
var ref = this;
var _onStartCallbackFired = ref._onStartCallbackFired;

@@ -1233,3 +1031,2 @@ var _easingFunction = ref._easingFunction;

var _reverseDelayTime = ref._reverseDelayTime;
var _delayTime = ref._delayTime;
var _yoyo = ref._yoyo;

@@ -1242,46 +1039,35 @@ var _reversed = ref._reversed;

var object = ref.object;
var isJoinToString = ref.isJoinToString;
var property;
var elapsed;
var value;
var property;
var elapsed;
var value;
time = time !== undefined ? time : now$1();
time = time !== undefined ? time : now();
if (time < _startTime) {
return true;
}
if (time < _startTime) {
return true
}
if (!_onStartCallbackFired) {
if (!_onStartCallbackFired) {
if (!this._rendered) {
this.render();
if (!this._rendered) {
this.emit(EVENT_START, object);
this.render();
this._rendered = true;
}
this.emit('start', object);
this._onStartCallbackFired = true;
}
this._rendered = true;
elapsed = (time - _startTime) / _duration;
elapsed = elapsed > 1 ? 1 : elapsed;
elapsed = _reversed ? 1 - elapsed : elapsed;
}
value = typeof _easingFunction === 'function' ? _easingFunction(elapsed) : defaultEasing(elapsed);
this._onStartCallbackFired = true;
}
elapsed = (time - _startTime) / _duration;
elapsed = elapsed > 1 ? 1 : elapsed;
elapsed = _reversed ? 1 - elapsed : elapsed;
value = typeof _easingFunction === "function" ? _easingFunction(elapsed) : defaultEasing(elapsed);
if (typeof _valuesEnd === "function") {
this.emit('update', _valuesEnd(elapsed), value, elapsed);
} else {
for (property in _valuesEnd) {
// Don't update properties that do not exist in the source object
if (_valuesStart[property] === undefined) {
continue;
continue
}

@@ -1291,14 +1077,9 @@

var end = _valuesEnd[property];
value = _easingFunction[property] ? _easingFunction[property](elapsed) : value;
value = _easingFunction[property] ? _easingFunction[property](elapsed) : value;
if (typeof end === "function") {
if (typeof end === 'function') {
object[property] = end(value);
} else if (Array.isArray(end)) {
object[property] = _interpolationFunction(end, value);
} else if (typeof(end) === 'string') {
} else if (typeof (end) === 'string') {
if (end.charAt(0) === '+' || end.charAt(0) === '-') {

@@ -1311,297 +1092,302 @@ end = start + parseFloat(end);

// Protect against non numeric properties.
if (typeof(end) === 'number') {
object[property] = (((start + (end - start) * value) * maxDecNum) | 0) / maxDecNum;
if (typeof (end) === 'number') {
object[property] = start + (end - start) * value;
}
} else if (typeof(start) === 'number') {
object[property] = (((start + (end - start) * value) * maxDecNum) | 0) / maxDecNum;
} else if (typeof (start) === 'number') {
object[property] = start + (end - start) * value;
}
}
this.emit('update', object, value, elapsed);
this.emit(EVENT_UPDATE, object, value, elapsed);
}
this.object = object;
if (elapsed === 1 || (_reversed && elapsed === 0)) {
if (elapsed === 1 || (_reversed && elapsed === 0)) {
if (_repeat) {
if (isFinite(_repeat)) {
this._repeat--;
}
if (_repeat) {
for (property in _valuesEnd) {
if (typeof (_valuesEnd[property]) === 'string' && typeof (_valuesStart[property]) === 'number') {
this$1._valuesStart[property] = _valuesStart[property] + parseFloat(_valuesEnd[property]);
}
}
if (isFinite(_repeat)) {
this._repeat--;
}
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? EVENT_REVERSE : EVENT_REPEAT, object);
for (property in _valuesEnd) {
if (_yoyo) {
this._reversed = !_reversed;
}
if (typeof(_valuesEnd[property]) === 'string' && typeof(_valuesStart[property]) === 'number') {
this$1._valuesStart[property] = _valuesStart[property] + parseFloat(_valuesEnd[property]);
if (!_reversed && _repeatDelayTime) {
this._startTime += _duration + _repeatDelayTime;
} else if (_reversed && _reverseDelayTime) {
this._startTime += _duration + _reverseDelayTime;
} else {
this._startTime += _duration;
}
}
return true
} else {
this.emit(EVENT_COMPLETE, object);
this._repeat = this._r;
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? 'reverse' : 'repeat', object);
if (_yoyo) {
this._reversed = !_reversed;
return false
}
}
if (!_reversed && _repeatDelayTime) {
this._startTime += _duration + _repeatDelayTime;
} else if (_reversed && _reverseDelayTime) {
this._startTime += _duration + _reverseDelayTime;
} else {
this._startTime += _duration;
}
return true
};
return true;
return Tween;
}(EventClass));
} else {
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
}
};
this.emit('complete', object);
this._repeat = this._r;
var Plugins = function Plugins () {};
return false;
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]);
}
}
}
return true;
};
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
}
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];
}
}
}
};
var Plugins = function Plugins () {};
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]) + ")";
}
}
Plugins.Attr = function Attr (Composite) {
var layer = this.domNode;
return {
update: function update(RenderObject, value) {
for (var p in RenderObject) {
if (cache.transform[p] || cache.filter[p] || cache.scroll[p]) { continue; }
layer.setAttribute(p, RenderObject[p]);
}
}
}
if (transform) {
style.transform = transform;
}
}
}
};
Plugins.Style = function Style () {
var layer = this.domNode,
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,
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,
bbox = {}, self;
var attrName = 'transform', rotate = 'rotate', x = 'x', 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(Tween, RenderObject) {
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
}
return self.setOrigin(xPos, yPos);
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]) + ")";
}
}
},
setOrigin: function setOrigin(x, y) {
if (transform) {
layer.setAttribute(attrName, transform);
}
var ref = layer.getBoundingClientRect();
var width = ref.width;
var height = ref.height;
var left = ref.left;
var top = ref.top;
return self
},
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);
init: function init () {
return self.setOrigin(xPos, yPos)
},
if (bbox.x !== undefined && bbox.y !== undefined) {
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 += x - diffX;
y += y - diffY;
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;
bbox.x = x;
bbox.y = y;
x += x - diffX;
y += y - diffY;
}
return self;
}
}
bbox.x = x;
bbox.y = y;
return self
}
})
};
Plugins.Filter = function Filter () {
var layer = this.domNode,
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;
}
}
}
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 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) {
var Composite = function Composite (domNode) {
this.domNode = domNode;
this.plugins = {};
var self = this;
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.domNode = domNode;
this.plugins = {};
return this
};
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 this$1 = this;
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
var ref = this;
var plugins = ref.plugins;
var ref = this;
var plugins = ref.plugins;
for (var p in plugins) {
for (var p in plugins) {
var plugin = plugins[p];
var plugin = plugins[p];
plugin && plugin[type] && plugin[type].apply(this$1, args);
}
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)
};
return this;
Composite.prototype.init = function init (object) {
return this.map('init', object)
};
Composite.prototype.render = function render (object, value, elapsed) {
return this.map('update', object, value, elapsed);
Composite.prototype.fetch = function fetch (object) {
return this.map('fetch', object)
};
Composite.prototype.init = function init (object) {
return this.map('init', object);
Composite.prototype.applyPlugin = function applyPlugin (name) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
};
Composite.prototype.fetch = function fetch$1 (object) {
if (Plugins[name] !== undefined) {
this.plugins[name] = Plugins[name].apply(this, args);
return this.plugins[name]
}
return this.map('fetch', fetch);
return this
};
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;
node.appendChild(this.domNode);
return this
};
var Timeline = (function (Tween$$1) {
function Timeline(params) {
function Timeline (params) {
Tween$$1.call(this);
this._totalDuration = 0;
this._startTime = now$1();
this._startTime = now();
this._tweens = {};

@@ -1613,3 +1399,3 @@ this._elapsed = 0;

return this;
return this
}

@@ -1620,6 +1406,8 @@

Timeline.prototype.constructor = Timeline;
Timeline.prototype.setLabel = function setLabel (name, value) {
this._labels[name] = this.parsePosition(0, value, 0);
return this;
return this
};
Timeline.prototype.parsePosition = function parsePosition (startTime, input, total) {

@@ -1630,35 +1418,24 @@ var this$1 = this;

if (typeof input === "string") {
if (typeof input === 'string') {
for (var label in this$1._labels) {
if (input.indexOf(label) === 0) {
var inp = input.split(label)[1];
if (inp.length === 0 || (inp[0] === '+' || inp[0] === '-')) {
position = this$1._labels[label] + startTime;
input = input.replace(label, '');
}
}
}
if (input.indexOf('+') === 0 || input.indexOf('-') === 0) {
position += parseFloat(input);
}
} else if (typeof input === "number") {
} else if (typeof input === 'number') {
position += input;
}
return position;
return position
};
Timeline.prototype.map = function map (fn) {

@@ -1670,15 +1447,14 @@ var this$1 = this;

}
return this;
return this
};
Timeline.prototype.add = function add$$1 (tween, position) {
if (typeof tween === 'object' && !(tween instanceof Tween$$1)) {
tween = new Tween$$1(tween.from, tween);
}
if (typeof tween === "object" && !(tween instanceof Tween$$1)) {
tween = new Tween$$1(tween.from, tweens);
}
var ref = this;
var _defaultParams = ref._defaultParams;
var _totalDuration = ref._totalDuration;
var _defaultParams = ref._defaultParams;
var _totalDuration = ref._totalDuration;

@@ -1692,20 +1468,24 @@ if (_defaultParams) {

tween._startTime = this.parsePosition(0, position, _totalDuration);
tween._startTime += now$1();
tween._startTime += now();
this._totalDuration = Math.max(_totalDuration, tween._duration + tween._startTime);
this._tweens[tween.id] = tween;
return this;
return this
};
Timeline.prototype.restart = function restart () {
this._startTime += now$1();
this._startTime += now();
add(this);
add(this);
return this.emit('restart');
return this.emit('restart')
};
Timeline.prototype.easing = function easing (easing$1) {
return this.map(function (tween) { return tween.easing(easing$1); });
return this.map(function (tween) { return tween.easing(easing$1); })
};
Timeline.prototype.interpolation = function interpolation (interpolation$1) {
return this.map(function (tween) { return tween.interpolation(interpolation$1); });
return this.map(function (tween) { return tween.interpolation(interpolation$1); })
};
Timeline.prototype.update = function update$$1 (time) {

@@ -1723,5 +1503,3 @@ var ref = this;

if (time < _startTime) {
return true;
return true
}

@@ -1737,8 +1515,8 @@

for (var tween in _tweens) {
var _tween = _tweens[tween];
var _tween = _tweens[tween];
if (_tween.skip || _tween.update(_timing)) {
continue;
continue
} else {
_tween.skip = true;
}
_tween.skip = true;
}
}

@@ -1749,5 +1527,3 @@

if (elapsed === 1 || (_reversed && elapsed === 0)) {
if (_repeat) {
if (isFinite(_repeat)) {

@@ -1771,30 +1547,30 @@ this._repeat--;

}
for (var tween$1 in _tweens) {
var _tween$1 = _tweens[tween$1];
if (_tween$1.skip) {
_tween$1.skip = false;
}
}
return true;
for (var tween$1 in _tweens) {
var _tween$1 = _tweens[tween$1];
if (_tween$1.skip) {
_tween$1.skip = false;
}
}
return true
} else {
this.emit('complete');
this._repeat = this._r;
return false;
return false
}
}
return true;
return true
};
};
Timeline.prototype.elapsed = function elapsed (value) {
return value !== undefined ? this.update(value * this._totalDuration) : this._elapsed;
return value !== undefined ? this.update(value * this._totalDuration) : this._elapsed
};
Timeline.prototype.seek = function seek (value) {
return this.update(value < 1.1 ? value * this._totalDuration : value)
};
return Timeline;

@@ -1806,17 +1582,16 @@ }(Tween));

function TweenInit (target) {
var from = target.from;
var to = target.to;
var duration = target.duration; if ( duration === void 0 ) duration = 1000;
var easing = target.easing; if ( easing === void 0 ) easing = lin;
var events = target.events;
var instance = target.instance;
var tweenInstance = new Tween(from, instance).to(to, duration).easing(lin);
if (events) {
tweenInstance._events = events;
}
target.start = tweenInstance.start.bind(tweenInstance);
var from = target.from;
var to = target.to;
var duration = target.duration; if ( duration === void 0 ) duration = 1000;
var easing = target.easing; if ( easing === void 0 ) easing = lin;
var events = target.events;
var instance = target.instance;
var tweenInstance = new Tween(from, instance).to(to, duration).easing(easing);
if (events) {
tweenInstance._events = events;
}
target.start = tweenInstance.start.bind(tweenInstance);
}
/* Shims will be deprecated in next update, please update browser */
exports.TweenInit = TweenInit;

@@ -1829,4 +1604,4 @@ exports.nextId = nextId;

exports.remove = remove;
exports.add = add$1;
exports.now = now$1;
exports.add = add;
exports.now = now;
exports.update = update;

@@ -1833,0 +1608,0 @@ exports.autoPlay = autoPlay;

@@ -1,1 +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}function n(t){var e=t.from,n=t.to,r=t.duration;void 0===r&&(r=1e3);var i=t.easing;void 0===i&&(i=rt);var o=t.events,a=t.instance,s=new H(e,a).to(n,r).easing(rt);o&&(s._events=o),t.start=s.start.bind(s)}void 0===Object.assign&&(Object.assign=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return e.map(function(e){for(var n in e)t[n]=e[n]}),t});var r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof t?t:{},i=["webkit","moz","ms","o"],o="AnimationFrame",a="Request"+o,s="Cancel"+o,u="CancelRequest"+o,f=r.setTimeout,h=r.clearTimeout;if(f&&void 0===r.requestAnimationFrame){var p,c,l=Date.now(),d=50/3,v=d;i.map(function(t){void 0===(p=r[t+a])&&(p=function(t){return f(function(){c=Date.now(),t(c-l),v=d+(Date.now()-c)},v)})}),void 0!==p&&(r.requestAnimationFrame=p)}if(h&&void 0===r.cancelAnimationFrame&&void 0===(r.cancelAnimationFrame=r.cancelRequestAnimationFrame)){var y;i.map(function(t){void 0===(y=r[t+s])&&void 0===(y=r[t+u])&&(y=function(t){return h(t)})}),void 0!==y&&(r.cancelAnimationFrame=y)}void 0===Array.isArray&&(Array.isArray=function(t){return void 0!==t&&"object"==typeof t&&t.length&&void 0!==t.push&&void 0!==t.splice});var m,_={},g=!1,b=!1,T={},w="undefined"!=typeof window?window:"undefined"!=typeof global?global:{},O=0;Object.defineProperty(_,"length",{enumerable:!1,writable:!0,value:0});var I=function(t,e,n,r,i,o){var a=this,s=T[t];if(s)for(var u=s.length;u--;)s[u].call(a,e,n,r,i,o)},M=function(t,e){void 0===T[t]&&(T[t]=[]),T[t].push(e)},F=function(t,e){void 0===T[t]&&(T[t]=[]),M(t,function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];e.apply(void 0,n),j(t)})},j=function(t,e){if(void 0!==t&&void 0!==T[t])if(void 0!==e)for(var n=T[name],r=0;r<n.length;)n[r]===e&&n.splice(r,1),r++;else T[name]=[]},A=function(t){var e=t.id;_[e]=t,_.length++,b&&!g&&(q(),g=!0,I("start")),I("add",t,_)},P=function(){var t=O;return O++,t},x=function(){return _},E=function(t){b=t},S=function(){_={},Object.defineProperty(_,"length",{enumerable:!1,writable:!0,value:0})},D=function(t){for(var e in _)if(t.id===+e)return _[+e];return null},N=function(t){return null!==D(t)},k=function(t){for(var e in _)t.id===+e&&(delete _[+e],_.length--)},C=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!==w.performance&&void 0!==w.performance.now)return w.performance.now.bind(w.performance);var t=w.performance&&w.performance.timing&&w.performance.timing.navigationStart?w.performance.timing.navigationStart:Date.now();return function(){return Date.now()-t}}(),q=function(t,e){if(t=void 0!==t?t:C(),b&&(m=requestAnimationFrame(q)),I("update",t,_),0===_.length)return g=!1,cancelAnimationFrame(m),I("stop",t),!1;for(var n in _)_[n].update(t)||e?n++:(delete _[+n],_.length--);return!0};if(w.document){var B=w.document,L=0,R=0;B.addEventListener("visibilitychange",function(t){if(0===_.length)return!1;if(document.hidden)R=C();else{L=C()-R;for(var e in _)_[e]._startTime+=L}return!0})}var z={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*(-Math.pow(2,-10*(t-1))+2)}},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,t<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?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-z.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*z.Bounce.In(2*t):.5*z.Bounce.Out(2*t-1)+.5}}},J={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=J.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=J.Utils.Bernstein,a=0;a<=r;a++)n+=i(1-e,r-a)*i(e,a)*t[a]*o(r,a);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=J.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=J.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),a=.5*(r-e),s=i*i,u=i*s;return(2*e-2*n+o+a)*u+(-3*e+3*n-2*o-a)*s+o*i+e}}},U=/rgb|hsl|hsv/g,X=/ahsv|ahsl|argb/g,Y=/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi,Z=/^#([0-9a-f]{6}|[0-9a-f]{3})$/i,Q=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},V=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 U.test(e)?(i=e,o=n,null):e===t[n]?null:"number"==typeof e?e-t[n]:V(t[n],e)});var a=null!==o?o+6:null;i&&X.test(i)&&(o++,a++);var s=[].concat(t);return function(e){for(var i=0,u=n.length;i<u;i++){var f=n[i];"function"==typeof f?s[i]=f(e):"number"==typeof f&&(s[i]=((t[i]+f*e)*r|0)/r,null!==o&&i>o&&i<a&&(s[i]=0|s[i]))}return s}}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]=V(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){n-=t;var h=t===n;return function(e){return h?n:((t+n*e)*r|0)/r}}if("string"==typeof t){var p=t.replace(Z,Q).match(Y).map(e),c=n.replace(Z,Q).match(Y).map(e),l=V(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}},W={add:function(t){return W[t]&&JSON.stringify(t)&&JSON.stringify(W[t])?W[t]:(W[t]=t,t)}},G=1e4,$=z.Linear.None,H=function t(e,n){return void 0===e&&(e={}),this.isJoinToString="string"==typeof e,this.object=e,this._valuesStart=t.createEmptyConst(e),this._valuesEnd=t.createEmptyConst(e),this._duration=1e3,this._easingFunction=$,this._interpolationFunction=J.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=P(),n&&n.to?new t(e).to(n.to,n):this};H.createEmptyConst=function(t){return"number"==typeof t?0:Array.isArray(t)?[]:"object"==typeof t?{}:""},H.checkValidness=function(t){return void 0!==t&&null!==t&&""!==t&&NaN!==t&&t!==1/0},H.prototype.isPlaying=function(){return this._isPlaying},H.prototype.isStarted=function(){return this._onStartCallbackFired},H.prototype.reverse=function(){var t=this,e=t._reversed;return this._reversed=!e,this},H.prototype.reversed=function(){return this._reversed},H.prototype.useActiveMode=function(){return this.object=W.add(this.object),this},H.prototype.off=function(t,e){if(!this._events||void 0===this._events[t])return this;if(void 0!==t&&void 0!==e)for(var n=this._events[t],r=0;r<n.length;)n[r]===e&&n.splice(r,1),r++;else void 0!==t&&void 0===e&&(this._events[t]=[]);return this},H.prototype.on=function(t,e){return this._events&&void 0!==this._events[t]||(this._events||(this._events={}),this._events[t]=[]),this._events[t].push(e),this},H.prototype.once=function(t,e){var n=this;return this._events&&void 0!==this._events[t]||(this._events||(this._events={}),this._events[t]=[]),this.on(t,function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];e.call.apply(e,[n].concat(r)),n.off(t)})},H.prototype.emit=function(t,e,n,r,i,o){var a=this,s=this,u=s._events;if(!u)return this;var f=u[t];if(!f)return this;for(var h=f.length;h--;)f[h].call(a,e,n,r,i,o);return this},H.prototype.pause=function(){return this._isPlaying?(this._isPlaying=!1,k(this),this._pausedTime=C(),this.emit("pause",this.object)):this},H.prototype.play=function(){return this._isPlaying?this:(this._isPlaying=!0,this._startTime+=C()-this._pausedTime,A(this),this._pausedTime=C(),this.emit("play",this.object))},H.prototype.restart=function(t){return this._repeat=this._r,this._startTime=C()+(t?0:this._delayTime),this._isPlaying||A(this),this.emit("restart",this._object)},H.prototype.seek=function(t,e){return this._startTime=C()+Math.max(0,Math.min(t,this._duration)),this.emit("seek",t,this._object),e?this:this.pause()},H.prototype.duration=function(t){return this._duration="function"==typeof t?t(this._duration):t,this},H.prototype.to=function(t,e){var n=this;if(void 0===t&&(t={}),void 0===e&&(e=1e3),"number"==typeof t){var r={Number:t};this._valuesEnd=r}else"string"==typeof t&&this.isJoinToString?this._valuesEnd=V(this.object,t):this._valuesEnd=t;if("number"==typeof e)this._duration="function"==typeof e?e(this._duration):e;else if("object"==typeof e)for(var i in e)n[i]&&(o=n)[i].apply(o,Array.isArray(e)?e:[e]);return this;var o},H.prototype.render=function(){var t=this,e=this,n=(e._startTime,e._delayTime,e._valuesEnd),r=(e._valuesStart,e.object);if("object"==typeof n)for(var i in n)"object"==typeof n[i]&&n[i]?(t._valuesEnd[i]=V(r[i],n[i]),t.object[i]=t._valuesEnd[i](0)):"string"==typeof n[i]&&"string"==typeof r[i]&&(t._valuesEnd[i]=V(r[i],n[i]),t.object[i]=t._valuesEnd[i](0)),H.checkValidness(r[i])!==!1&&r[i]!==n[i]&&(t._valuesStart[i]=r[i])},H.prototype.start=function(t){return this._startTime=void 0!==t?t:C(),this._startTime+=this._delayTime,this.render(),this._rendered=!0,A(this),this.emit("start",this.object),this._isPlaying=!0,this},H.prototype.stop=function(){var t=this,e=t._isPlaying,n=t.object;return e?(k(this),this._isPlaying=!1,this.emit("stop",n)):this},H.prototype.end=function(){var t=this,e=t._startTime,n=t._duration;return this.update(e+n)},H.prototype.delay=function(t){return this._delayTime="function"==typeof t?t(this._delayTime):t,this._startTime+=this._delayTime,this},H.prototype.repeat=function(t){return this._repeat="function"==typeof t?t(this._repeat):t,this._r=this._repeat,this},H.prototype.repeatDelay=function(t){return this._repeatDelayTime="function"==typeof t?t(this._repeatDelayTime):t,this},H.prototype.reverseDelay=function(t){return this._reverseDelayTime="function"==typeof t?t(this._reverseDelayTime):t,this},H.prototype.yoyo=function(t){return this._yoyo="function"==typeof t?t(this._yoyo):t,this},H.prototype.easing=function(t){return this._easingFunction=t,this},H.prototype.interpolation=function(t){return this._interpolationFunction=t,this},H.prototype.get=function(t){return this.update(t),this.object},H.prototype.update=function(t){var e,n,r,i=this,o=this,a=o._onStartCallbackFired,s=o._easingFunction,u=o._interpolationFunction,f=o._repeat,h=o._repeatDelayTime,p=o._reverseDelayTime,c=(o._delayTime,o._yoyo),l=o._reversed,d=o._startTime,v=o._duration,y=o._valuesStart,m=o._valuesEnd,_=o.object;o.isJoinToString;if(t=void 0!==t?t:C(),t<d)return!0;if(a||(this._rendered||(this.render(),this.emit("start",_),this._rendered=!0),this._onStartCallbackFired=!0),n=(t-d)/v,n=n>1?1:n,n=l?1-n:n,r="function"==typeof s?s(n):$(n),"function"==typeof m)this.emit("update",m(n),r,n);else{for(e in m)if(void 0!==y[e]){var g=y[e],b=m[e];r=s[e]?s[e](n):r,"function"==typeof b?_[e]=b(r):Array.isArray(b)?_[e]=u(b,r):"string"==typeof b?(b="+"===b.charAt(0)||"-"===b.charAt(0)?g+parseFloat(b):parseFloat(b),"number"==typeof b&&(_[e]=((g+(b-g)*r)*G|0)/G)):"number"==typeof g&&(_[e]=((g+(b-g)*r)*G|0)/G)}this.emit("update",_,r,n)}if(1===n||l&&0===n){if(f){isFinite(f)&&this._repeat--;for(e in m)"string"==typeof m[e]&&"number"==typeof y[e]&&(i._valuesStart[e]=y[e]+parseFloat(m[e]));return this.emit(l?"reverse":"repeat",_),c&&(this._reversed=!l),!l&&h?this._startTime+=v+h:l&&p?this._startTime+=v+p:this._startTime+=v,!0}return this.emit("complete",_),this._repeat=this._r,!1}return!0};var K={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}},tt=function(){};tt.Attr=function(t){var e=this.domNode;return{update:function(t,n){for(var r in t)K.transform[r]||K.filter[r]||K.scroll[r]||e.setAttribute(r,t[r])}}},tt.Style=function(){var t=this.domNode,e=t.style;return{update:function(t){for(var n in t)K.transform[n]||K.filter[n]||(e[n]=t[n])}}},tt.Transform=function(){var t=this.domNode,e=t.style;return{update:function(t){var n="";for(var r in t)K.transform[r]&&("x"===r||"y"===r||"z"===r?n+=" translate3d( "+(t.x||"0px")+", "+(t.y||"0px")+", "+(t.z||"0px")+")":K.transform[r]&&(n+=" "+r+"( "+t[r]+")"));n&&(e.transform=n)}}},tt.SVGTransform=function(t,e){var n,r=this.domNode,i={},o="transform",a="rotate",s="x",u="y";return n={update:function(f){var h="";for(var p in f)K[o][p]&&(void 0!==i.x&&void 0!==i.y?h+=p===a?" rotate("+f[p]+" "+i.x+" "+i.y+")":p===s||p===u?" translate("+(f.x||0)+", "+(f.y||0)+")":" "+p+"("+f[p]+")":n.setOrigin(t,e));return h&&r.setAttribute(o,h),n},init:function(r,i){return n.setOrigin(t,e)},setOrigin:function(t,e){var o=r.getBoundingClientRect(),a=o.width,s=o.height,u=o.left,f=o.top;return t="number"==typeof t?u+t:"string"==typeof t&&t.indexOf("%")>-1?u+a*(parseFloat(t)/100):u+a/2,e="number"==typeof e?u+e:"string"==typeof e&&e.indexOf("%")>-1?f+s*(parseFloat(e)/100):f+s/2,void 0!==i.x&&void 0!==i.y&&(t+=t-diffX,e+=e-diffY),i.x=t,i.y=e,n}}},tt.Filter=function(){var t=this.domNode,e=t.style;return{update:function(t){var n="";for(var r in t)K.filter[r]&&K.filter[r]&&(n+=" "+r+"( "+t[r]+")");n&&(e.webkitFilter=e.filter=n)}}},tt.Scroll=function(){var t=this.domNode;return{update:function(e){for(var n in e)K.scroll[n]&&(t[n]=e[n])}}};var et=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};et.prototype.map=function(t){for(var e=this,n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];var i=this,o=i.plugins;for(var a in o){var s=o[a];s&&s[t]&&s[t].apply(e,n)}return this},et.prototype.render=function(t,e,n){return this.map("update",t,e,n)},et.prototype.init=function(t){return this.map("init",t)},et.prototype.fetch=function(t){return this.map("fetch",fetch)},et.prototype.applyPlugin=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return void 0!==tt[t]?(this.plugins[t]=tt[t].apply(this,e),this.plugins[t]):this},et.prototype.appendTo=function(t){return t.appendChild(this.domNode),this};var nt=function(t){function e(e){return t.call(this),this._totalDuration=0,this._startTime=C(),this._tweens={},this._elapsed=0,this._id=P(),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 a=e.split(o)[1];0!==a.length&&"+"!==a[0]&&"-"!==a[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,tweens));var r=this,i=r._defaultParams,o=r._totalDuration;if(i)for(var a in i)e[a](i[a]);return e._startTime=this.parsePosition(0,n,o),e._startTime+=C(),this._totalDuration=Math.max(o,e._duration+e._startTime),this._tweens[e.id]=e,this},e.prototype.restart=function(){return this._startTime+=C(),add(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,a=e._startTime,s=e._reversed,u=e._yoyo,f=e._repeat;if(t<a)return!0;var h=Math.min(1,Math.max(0,(t-a)/r));h=s?1-h:h,this._elapsed=h;var p=t-a,c=s?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||s&&0===h){if(f){isFinite(f)&&this._repeat--,this.emit(s?"reverse":"repeat"),u&&(this._reversed=!s),!s&&i?this._startTime+=r+i:s&&o?this._startTime+=r+o:this._startTime+=r;for(var v in n){var y=n[v];y.skip&&(y.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}(H),rt=function(t){return t};t.TweenInit=n,t.nextId=P,t.has=N,t.get=D,t.getAll=x,t.removeAll=S,t.remove=k,t.add=A,t.now=C,t.update=q,t.autoPlay=E,t.on=M,t.once=F,t.off=j,t.emit=I,t.Tween=H,t.Easing=z,t.Interpolation=J,t.Composite=et,t.Timeline=nt,t.Plugins=tt,t.PropertyTypes=K,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
{
"standard": {
"ignore": [
"dist/",
"test/"
]
},
"name": "es6-tween",
"version": "2.5.1",
"version": "2.5.2",
"description": "ES6 implementation of amazing tween.js",

@@ -18,10 +12,10 @@ "browser": "dist/Tween.min.js",

"scripts": {
"minify": "rollup -c --environment BUILD:prod",
"source": "rollup -c --sourcemap",
"source": "rollup -c --environment min:false",
"minify": "rollup -c --environment min:true",
"build": "npm run source && npm run minify",
"dev": "rollup -c -w --sourcemap",
"dev": "rollup -c -w",
"lint": "eslint src",
"fix": "eslint --fix src",
"test-unit": "nodeunit test/unit/nodeunitheadless.js",
"test": "npm run test-unit && npm run fix && npm run lint",
"fix": "standard --fix",
"lint": "standard --verbose | snazzy",
"test": "npm run lint && npm run test-unit",
"semantic-release": "semantic-release pre && npm publish && semantic-release post --owner=sole --user=dalisoft"

@@ -52,13 +46,13 @@ },

"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": "^1.0.2",
"rollup-watch": "^3.2.2",
"rollup-plugin-uglify": "^2.0.1",
"rollup-watch": "^4.3.1",
"semantic-release": "latest",
"snazzy": "^7.0.0",
"standard": "^10.0.2",
"uglify-js-harmony": "^2.7.7"
"uglify-es": "^3.0.27"
},
"dependencies": {}
}

@@ -6,3 +6,3 @@ # es6-tween

[![size](http://img.badgesize.io/https://unpkg.com/es6-tween)](https://unpkg.com/es6-tween)
[![gzipsize](http://img.badgesize.io/https://unpkg.com/es6-tween?compression=gzip)](https://unpkg.com/es6-tween)
[![gzipsize](http://img.badgesize.io/https://unpkg.com/es6-tween?compression=gzip&cache=false)](https://unpkg.com/es6-tween)
[![CDNJS](https://img.shields.io/cdnjs/v/es6-tween.svg)](https://cdnjs.com/libraries/es6-tween)

@@ -9,0 +9,0 @@ [![jsdelivr](https://img.shields.io/badge/cdn-jsdelivr-brightgreen.svg)](https://cdn.jsdelivr.net/npm/es6-tween) [![unpkg](https://img.shields.io/badge/cdn-unpkg-brightgreen.svg)](https://unpkg.com/es6-tween) [![npmcdn](https://img.shields.io/badge/cdn-npmcdn-brightgreen.svg)](https://npmcdn.com/es6-tween)

import buble from 'rollup-plugin-buble'
import uglify from 'rollup-plugin-uglify'
import { minify } from 'uglify-js-harmony'
import { minify } from 'uglify-es'
const { BUILD } = process.env
const { min } = process.env
const isMinify = min === 'true'
const minSuffix = isMinify ? '.min' : ''
const plugins = [ buble({
objectAssign: 'Object.assign'
}) ]
const plugins = [
// ES6->ES5 syntax/code transpiler
buble({
// Spread to Object merge/assign
objectAssign: `Object.assign`,
// Features
transforms: {
// For of feature
dangerousForOf: true
}
})
]
let moduleName = 'Tween'
let destFile = 'dist/' + moduleName
if (BUILD === 'prod') {
plugins.push(uglify({}, minify))
destFile = 'dist/' + moduleName + '.min'
if ( isMinify ) {
plugins.push(
// Minify
uglify({
sourceMap: {
filename: `src/Tween.js`,
url: `dist/Tween${minSuffix}.js.map`
}
}, minify)
);
}
destFile = destFile + '.js'
export default {
entry: 'src/Tween.js',
format: 'umd',
dest: destFile, // equivalent to --output
sourceMap: true,
dest: `dist/Tween${minSuffix}.js`,
moduleName: 'TWEEN',
plugins: plugins
}

@@ -1,58 +0,53 @@

import Plugins from './Plugins';
import Plugins from './Plugins'
export default class Composite {
constructor(domNode) {
constructor (domNode) {
this.domNode = domNode
this.plugins = {}
let self = this;
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.domNode = domNode;
this.plugins = {};
return this
}
this.map = this.map.bind(this);
this.render = this.render.bind(this);
this.init = this.init.bind(this);
this.fetch = this.fetch.bind(this);
map (type, ...args) {
let {plugins} = this
return this;
}
map (type, ...args) {
let { plugins } = this;
for (let p in plugins) {
let plugin = plugins[p]
for (let p in plugins) {
plugin && plugin[type] && plugin[type].apply(this, args)
}
let plugin = plugins[p];
return this
}
plugin && plugin[type] && plugin[type].apply(this, args);
render (object, value, elapsed) {
return this.map('update', object, value, elapsed)
}
}
init (object) {
return this.map('init', object)
}
return this;
}
render (object, value, elapsed) {
fetch (object) {
return this.map('fetch', object)
}
return this.map('update', object, value, elapsed);
applyPlugin (name, ...args) {
if (Plugins[name] !== undefined) {
this.plugins[name] = Plugins[name].apply(this, args)
return this.plugins[name]
}
}
init (object) {
return this
}
return this.map('init', object);
}
fetch (object) {
return this.map('fetch', fetch);
}
applyPlugin(name, ...args) {
if (Plugins[name] !== undefined) {
this.plugins[name] = Plugins[name].apply(this, args);
return this.plugins[name];
}
return this;
}
appendTo(node) {
node.appendChild(this.domNode);
return this;
}
appendTo (node) {
node.appendChild(this.domNode)
return this
}
}

@@ -0,188 +1,126 @@

/* global global, window, Object, document, process, requestAnimationFrame, cancelAnimationFrame, setTimeout, clearTimeout */
import EventClass from './Event'
let _tweens = {}
let isStarted = false
let _autoPlay = false
let _tick
let {emit, on, once, off} = new EventClass()
let root = typeof (window) !== 'undefined' ? window : typeof (global) !== 'undefined' ? global : {}
let _nextId = 0
let _tweens = {};
let isStarted = false;
let _autoPlay = false;
let _tick;
let _events = {};
let root = typeof (window) !== "undefined" ? window : typeof (global) !== "undefined" ? global : {};
let _nextId = 0;
let _ticker = fn => typeof (requestAnimationFrame) !== 'undefined' ? requestAnimationFrame(fn) : setTimeout(fn, 16.6)
let _stopTicker = fn => typeof (cancelAnimationFrame) !== 'undefined' ? cancelAnimationFrame(fn) : clearTimeout(fn)
Object.defineProperty(_tweens, "length", {
enumerable: false,
writable: true,
value: 0
});
let setProp = (o, p, param) => Object.defineProperty(o, p, param)
setProp(_tweens, 'length', {enumerable: false, writable: true, value: 0})
const emit = function(name, a, b, c, d, e) {
let eventFn = _events[name];
if (eventFn) {
let i = eventFn.length;
while (i--) {
eventFn[i].call(this, a, b, c, d, e);
}
}
}
const on = (ev, fn) => {
if (_events[ev] === undefined) {
_events[ev] = [];
}
_events[ev].push(fn);
}
const once = (ev, fn) => {
if (_events[ev] === undefined) {
_events[ev] = [];
}
on(ev, (...args) => {
fn(...args);
off(ev);
});
}
const off = (ev, fn) => {
if (ev === undefined || _events[ev] === undefined) {
return;
}
if (fn !== undefined) {
let eventsList = _events[name]
, i = 0;
while (i < eventsList.length) {
if (eventsList[i] === fn) {
eventsList.splice(i, 1);
}
i++
}
} else {
_events[name] = [];
}
}
const add = tween => {
let { id } = tween;
_tweens[id] = tween;
_tweens.length++;
let {id} = tween
_tweens[id] = tween
_tweens.length++
if (_autoPlay && !isStarted) {
update();
isStarted = true;
emit('start');
}
emit('add', tween, _tweens);
if (_autoPlay && !isStarted) {
update()
isStarted = true
emit('start')
}
emit('add', tween, _tweens)
}
const nextId = () => {
let id = _nextId;
_nextId++;
return id;
let id = _nextId
_nextId++
return id
}
const getAll = () => {
return _tweens;
return _tweens
}
const autoPlay = (state) => {
_autoPlay = state;
_autoPlay = state
}
const removeAll = () => {
_tweens = {}
Object.defineProperty(_tweens, "length", {
enumerable: false,
writable: true,
value: 0
});
for (let id in _tweens) {
_tweens[+id] = null
delete _tweens[+id]
}
_tweens.length = 0
}
const get = tween => {
for (let searchTween in _tweens) {
if (tween.id === +searchTween) {
return _tweens[+searchTween]
}
}
for ( let searchTween in _tweens ) {
if (tween.id === +searchTween) {
return _tweens[+searchTween];
}
}
return null;
return null
}
const has = tween => {
return get(tween) !== null;
return get(tween) !== null
}
const remove = tween => {
for ( let searchTween in _tweens ) {
if (tween.id === +searchTween) {
delete _tweens[+searchTween];
_tweens.length--;
}
}
for (let searchTween in _tweens) {
if (tween.id === +searchTween) {
delete _tweens[+searchTween]
_tweens.length--
}
}
}
let now = function () {
if (typeof (process) !== "undefined" && process.hrtime !== undefined) {
return function () {
let time = process.hrtime();
let now = (function () {
if (typeof (process) !== 'undefined' && process.hrtime !== undefined) {
return function () {
let time = process.hrtime()
// Convert [seconds, nanoseconds] to milliseconds.
return time[0] * 1000 + time[1] / 1000000;
};
}
// In a browser, use window.performance.now if it is available.
else if (root.performance !== undefined &&
root.performance.now !== undefined) {
// Convert [seconds, nanoseconds] to milliseconds.
return time[0] * 1000 + time[1] / 1000000
}
// In a browser, use window.performance.now if it is available.
} else if (root.performance !== undefined &&
root.performance.now !== undefined) {
// This must be bound, because directly assigning this function
// leads to an invocation exception in Chrome.
return root.performance.now.bind(root.performance)
// Use Date.now if it is available.
} else {
let offset = root.performance && root.performance.timing && root.performance.timing.navigationStart ? root.performance.timing.navigationStart : Date.now()
return function () {
return Date.now() - offset
}
}
}())
// This must be bound, because directly assigning this function
// leads to an invocation exception in Chrome.
return root.performance.now.bind(root.performance)
}
// Use Date.now if it is available.
else {
let offset = root.performance && root.performance.timing && root.performance.timing.navigationStart ? root.performance.timing.navigationStart : Date.now();
return function () {
return Date.now() - offset;
}
}
}();
const update = (time, preserve) => {
time = time !== undefined ? time : now()
time = time !== undefined ? time : now();
if (_autoPlay) {
_tick = _ticker(update)
}
if (_autoPlay) {
_tick = requestAnimationFrame(update);
}
emit('update', time, _tweens);
emit('update', time, _tweens)
if (_tweens.length === 0) {
if (_tweens.length === 0) {
isStarted = false
_stopTicker(_tick)
emit('stop', time)
return false
}
isStarted = false;
cancelAnimationFrame(_tick);
emit('stop', time);
return false;
for (let i in _tweens) {
if (_tweens[i].update(time) || preserve) {
i++
} else {
delete _tweens[+i]
_tweens.length--
}
}
}
for ( let i in _tweens ) {
if (_tweens[i].update(time) || preserve) {
i++;
} else {
delete _tweens[+i];
_tweens.length--;
}
}
return true;
return true
}

@@ -192,23 +130,24 @@

if (root.document) {
let doc = root.document, timeDiff = 0, timePause = 0;
doc.addEventListener('visibilitychange', (ev) => {
if (_tweens.length === 0) {
return false;
}
if (document.hidden) {
timePause = now();
} else {
timeDiff = now() - timePause;
let doc = root.document
let timeDiff = 0
let timePause = 0
doc.addEventListener('visibilitychange', () => {
if (_tweens.length === 0) {
return false
}
for ( let tween in _tweens ) {
if (document.hidden) {
timePause = now()
} else {
timeDiff = now() - timePause
_tweens[tween]._startTime += timeDiff
for (let tween in _tweens) {
_tweens[tween]._startTime += timeDiff
}
}
}
}
return true;
})
return true
})
}
export { get, has, nextId, getAll, removeAll, remove, add, now, update, autoPlay, on, once, off, emit };
export { get, has, nextId, getAll, removeAll, remove, add, now, update, autoPlay, on, once, off, emit }

@@ -1,19 +0,20 @@

import Tween from './Tween';
import Tween from './Tween'
const lin = k => k;
const lin = k => k
export function TweenInit (target) {
const {
from,
to,
duration = 1000,
easing = lin,
events,
instance
} = target;
const tweenInstance = new Tween(from, instance).to(to, duration).easing(lin);
if (events) {
tweenInstance._events = events;
}
target.start = tweenInstance.start.bind(tweenInstance);
}
export default function TweenInit (target) {
const {
from,
to,
duration = 1000,
easing = lin,
events,
instance
} = target
const tweenInstance = new Tween(from, instance).to(to, duration).easing(easing)
if (events) {
tweenInstance._events = events
}
target.start = tweenInstance.start.bind(tweenInstance)
}
const Easing = {
Linear: {
Linear: {
None(k) {
None (k) {
return k
}
return k;
},
}
Quadratic: {
},
In (k) {
return k * k
},
Quadratic: {
Out (k) {
return k * (2 - k)
},
In(k) {
InOut (k) {
if ((k *= 2) < 1) {
return 0.5 * k * k
}
return k * k;
return -0.5 * (--k * (k - 2) - 1)
}
},
},
Out(k) {
Cubic: {
return k * (2 - k);
In (k) {
return k * k * k
},
},
Out (k) {
return --k * k * k + 1
},
InOut(k) {
InOut (k) {
if ((k *= 2) < 1) {
return 0.5 * k * k * k
}
if ((k *= 2) < 1) {
return 0.5 * k * k;
}
return 0.5 * ((k -= 2) * k * k + 2)
}
return - 0.5 * (--k * (k - 2) - 1);
},
}
Quartic: {
},
In (k) {
return k * k * k * k
},
Cubic: {
Out (k) {
return 1 - (--k * k * k * k)
},
In(k) {
InOut (k) {
if ((k *= 2) < 1) {
return 0.5 * k * k * k * k
}
return k * k * k;
return -0.5 * ((k -= 2) * k * k * k - 2)
}
},
},
Out(k) {
Quintic: {
return --k * k * k + 1;
In (k) {
return k * k * k * k * k
},
},
Out (k) {
return --k * k * k * k * k + 1
},
InOut(k) {
InOut (k) {
if ((k *= 2) < 1) {
return 0.5 * k * k * k * k * k
}
if ((k *= 2) < 1) {
return 0.5 * k * k * k;
}
return 0.5 * ((k -= 2) * k * k * k * k + 2)
}
return 0.5 * ((k -= 2) * k * k + 2);
},
}
Sinusoidal: {
},
In (k) {
return 1 - Math.cos(k * Math.PI / 2)
},
Quartic: {
Out (k) {
return Math.sin(k * Math.PI / 2)
},
In(k) {
InOut (k) {
return 0.5 * (1 - Math.cos(Math.PI * k))
}
return k * k * k * k;
},
},
Exponential: {
Out(k) {
In (k) {
return k === 0 ? 0 : Math.pow(1024, k - 1)
},
return 1 - (--k * k * k * k);
Out (k) {
return k === 1 ? 1 : 1 - Math.pow(2, -10 * k)
},
},
InOut (k) {
if (k === 0) {
return 0
}
InOut(k) {
if (k === 1) {
return 1
}
if ((k *= 2) < 1) {
return 0.5 * k * k * k * k;
}
if ((k *= 2) < 1) {
return 0.5 * Math.pow(1024, k - 1)
}
return - 0.5 * ((k -= 2) * k * k * k - 2);
return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2)
}
}
},
},
Circular: {
Quintic: {
In (k) {
return 1 - Math.sqrt(1 - k * k)
},
In(k) {
Out (k) {
return Math.sqrt(1 - (--k * k))
},
return k * k * k * k * k;
InOut (k) {
if ((k *= 2) < 1) {
return -0.5 * (Math.sqrt(1 - k * k) - 1)
}
},
return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1)
}
Out(k) {
},
return --k * k * k * k * k + 1;
Elastic: {
},
In (k) {
if (k === 0) {
return 0
}
InOut(k) {
if (k === 1) {
return 1
}
if ((k *= 2) < 1) {
return 0.5 * k * k * k * k * k;
}
return -Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI)
},
return 0.5 * ((k -= 2) * k * k * k * k + 2);
Out (k) {
if (k === 0) {
return 0
}
}
if (k === 1) {
return 1
}
},
return Math.pow(2, -10 * k) * Math.sin((k - 0.1) * 5 * Math.PI) + 1
},
Sinusoidal: {
InOut (k) {
if (k === 0) {
return 0
}
In(k) {
if (k === 1) {
return 1
}
return 1 - Math.cos(k * Math.PI / 2);
k *= 2
},
if (k < 1) {
return -0.5 * Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI)
}
Out(k) {
return 0.5 * Math.pow(2, -10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) + 1
}
return Math.sin(k * Math.PI / 2);
},
},
Back: {
InOut(k) {
In (k) {
let s = 1.70158
return 0.5 * (1 - Math.cos(Math.PI * k));
return k * k * ((s + 1) * k - s)
},
}
Out (k) {
let s = 1.70158
},
return --k * k * ((s + 1) * k + s) + 1
},
Exponential: {
InOut (k) {
let s = 1.70158 * 1.525
In(k) {
if ((k *= 2) < 1) {
return 0.5 * (k * k * ((s + 1) * k - s))
}
return k === 0 ? 0 : Math.pow(1024, k - 1);
return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2)
}
},
},
Out(k) {
Bounce: {
return k === 1 ? 1 : 1 - Math.pow(2, - 10 * k);
In (k) {
return 1 - Easing.Bounce.Out(1 - k)
},
},
Out (k) {
if (k < (1 / 2.75)) {
return 7.5625 * k * k
} else if (k < (2 / 2.75)) {
return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75
} else if (k < (2.5 / 2.75)) {
return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375
} else {
return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375
}
},
InOut(k) {
InOut (k) {
if (k < 0.5) {
return Easing.Bounce.In(k * 2) * 0.5
}
if (k === 0) {
return 0;
}
return Easing.Bounce.Out(k * 2 - 1) * 0.5 + 0.5
}
if (k === 1) {
return 1;
}
}
if ((k *= 2) < 1) {
return 0.5 * Math.pow(1024, k - 1);
}
}
return 0.5 * (- Math.pow(2, - 10 * (k - 1)) + 2);
}
},
Circular: {
In(k) {
return 1 - Math.sqrt(1 - k * k);
},
Out(k) {
return Math.sqrt(1 - (--k * k));
},
InOut(k) {
if ((k *= 2) < 1) {
return - 0.5 * (Math.sqrt(1 - k * k) - 1);
}
return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
}
},
Elastic: {
In(k) {
if (k === 0) {
return 0;
}
if (k === 1) {
return 1;
}
return -Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI);
},
Out(k) {
if (k === 0) {
return 0;
}
if (k === 1) {
return 1;
}
return Math.pow(2, -10 * k) * Math.sin((k - 0.1) * 5 * Math.PI) + 1;
},
InOut(k) {
if (k === 0) {
return 0;
}
if (k === 1) {
return 1;
}
k *= 2;
if (k < 1) {
return -0.5 * Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI);
}
return 0.5 * Math.pow(2, -10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) + 1;
}
},
Back: {
In(k) {
let s = 1.70158;
return k * k * ((s + 1) * k - s);
},
Out(k) {
let s = 1.70158;
return --k * k * ((s + 1) * k + s) + 1;
},
InOut(k) {
let s = 1.70158 * 1.525;
if ((k *= 2) < 1) {
return 0.5 * (k * k * ((s + 1) * k - s));
}
return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
}
},
Bounce: {
In(k) {
return 1 - Easing.Bounce.Out(1 - k);
},
Out(k) {
if (k < (1 / 2.75)) {
return 7.5625 * k * k;
} else if (k < (2 / 2.75)) {
return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
} else if (k < (2.5 / 2.75)) {
return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
} else {
return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
}
},
InOut(k) {
if (k < 0.5) {
return Easing.Bounce.In(k * 2) * 0.5;
}
return Easing.Bounce.Out(k * 2 - 1) * 0.5 + 0.5;
}
}
};
export default Easing;
export default Easing
const Interpolation = {
Linear(v, k) {
Linear (v, k) {
let m = v.length - 1
let f = m * k
let i = Math.floor(f)
let fn = Interpolation.Utils.Linear
let m = v.length - 1;
let f = m * k;
let i = Math.floor(f);
let fn = Interpolation.Utils.Linear;
if (k < 0) {
return fn(v[0], v[1], f)
}
if (k < 0) {
return fn(v[0], v[1], f);
}
if (k > 1) {
return fn(v[m], v[m - 1], m - 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)
},
return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);
Bezier (v, k) {
let b = 0
let n = v.length - 1
let pw = Math.pow
let bn = Interpolation.Utils.Bernstein
},
for (let i = 0; i <= n; i++) {
b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i)
}
Bezier(v, k) {
return b
},
let b = 0;
let n = v.length - 1;
let pw = Math.pow;
let bn = Interpolation.Utils.Bernstein;
CatmullRom (v, k) {
let m = v.length - 1
let f = m * k
let i = Math.floor(f)
let fn = Interpolation.Utils.CatmullRom
for (let i = 0; i <= n; i++) {
b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
}
if (v[0] === v[m]) {
if (k < 0) {
i = Math.floor(f = m * (1 + k))
}
return b;
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i)
} 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])
}
CatmullRom(v, k) {
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)
}
},
let m = v.length - 1;
let f = m * k;
let i = Math.floor(f);
let fn = Interpolation.Utils.CatmullRom;
Utils: {
if (v[0] === v[m]) {
Linear (p0, p1, t) {
return (p1 - p0) * t + p0
},
if (k < 0) {
i = Math.floor(f = m * (1 + k));
}
Bernstein (n, i) {
let fc = Interpolation.Utils.Factorial
return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
return fc(n) / fc(i) / fc(n - i)
},
} else {
Factorial: (function () {
let a = [1]
if (k < 0) {
return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);
}
return n => {
let s = 1
if (k > 1) {
return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
}
if (a[n]) {
return a[n]
}
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);
for (let i = n; i > 1; i--) {
s *= i
}
}
a[n] = s
return s
}
})(),
},
CatmullRom (p0, p1, p2, p3, t) {
let v0 = (p2 - p0) * 0.5
let v1 = (p3 - p1) * 0.5
let t2 = t * t
let t3 = t * t2
Utils: {
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1
}
Linear(p0, p1, t) {
}
return (p1 - p0) * t + p0;
},
Bernstein(n, i) {
let fc = Interpolation.Utils.Factorial;
return fc(n) / fc(i) / fc(n - i);
},
Factorial: (function() {
let a = [1];
return n => {
let s = 1;
if (a[n]) {
return a[n];
}
for (let i = n; i > 1; i--) {
s *= i;
}
a[n] = s;
return s;
};
})(),
CatmullRom(p0, p1, p2, p3, t) {
let v0 = (p2 - p0) * 0.5;
let v1 = (p3 - p1) * 0.5;
let t2 = t * t;
let t3 = t * t2;
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (- 3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
}
}
}
export default Interpolation;
export default Interpolation
const 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
}
};
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
}
}
export { cache as PropertyTypes };
export { cache as PropertyTypes }
export default class Plugins {
static Attr(Composite) {
let layer = this.domNode
return {
update(RenderObject, value) {
for (let p in RenderObject) {
if (cache.transform[p] || cache.filter[p] || cache.scroll[p]) continue;
layer.setAttribute(p, RenderObject[p]);
}
}
}
}
static Style() {
let layer = this.domNode,
style = layer.style;
return {
update(RenderObject) {
for (let p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) continue;
style[p] = RenderObject[p];
}
}
}
}
static Transform() {
let layer = this.domNode,
style = layer.style;
return {
update(RenderObject) {
let transform = '';
for (let 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;
}
}
}
}
static SVGTransform(xPos, yPos) {
let layer = this.domNode,
bbox = {}, self;
let attrName = 'transform', rotate = 'rotate', x = 'x', y = 'y';
return self = {
update(RenderObject) {
let transform = '';
for (let 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(Tween, RenderObject) {
static Attr () {
let layer = this.domNode
return {
update (RenderObject) {
for (let p in RenderObject) {
if (cache.transform[p] || cache.filter[p] || cache.scroll[p]) continue
layer.setAttribute(p, RenderObject[p])
}
}
}
}
return self.setOrigin(xPos, yPos);
static Style () {
let layer = this.domNode
let style = layer.style
return {
update (RenderObject) {
for (let p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) continue
style[p] = RenderObject[p]
}
}
}
}
},
setOrigin(x, y) {
static Transform () {
let layer = this.domNode
let style = layer.style
return {
update (RenderObject) {
let transform = ''
for (let 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]})`
}
}
let { width, height, left, top } = layer.getBoundingClientRect();
if (transform) {
style.transform = transform
}
}
}
}
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);
static SVGTransform (xPos, yPos) {
let layer = this.domNode
let bbox = {}
let self = null
let attrName = 'transform'
let rotate = 'rotate'
let x = 'x'
let y = 'y'
return (self = {
update (RenderObject) {
let transform = ''
for (let p in RenderObject) {
if (!cache[attrName][p]) continue
if (bbox.x === undefined || bbox.y === undefined) {
self.setOrigin(xPos, yPos)
continue
}
if (bbox.x !== undefined && bbox.y !== undefined) {
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]})`
}
}
x += x - diffX;
y += y - diffY;
if (transform) {
layer.setAttribute(attrName, transform)
}
}
return self
},
bbox.x = x;
bbox.y = y;
init () {
return self.setOrigin(xPos, yPos)
},
return self;
}
}
}
static Filter() {
let layer = this.domNode,
style = layer.style;
return {
update(RenderObject) {
let filter = '';
for (let p in RenderObject) {
if (!cache.filter[p]) continue;
if (cache.filter[p]) {
filter += ` ${ p }( ${ RenderObject[p] })`;
}
}
if (filter) {
style.webkitFilter = style.filter = filter;
}
}
}
}
static Scroll() {
let layer = this.domNode;
return {
update: (RenderObject) => {
for (let p in RenderObject) {
if (!cache.scroll[p]) continue;
layer[p] = RenderObject[p];
}
}
}
}
};
setOrigin (x, y) {
let {width, height, left, top} = layer.getBoundingClientRect()
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) {
let diffX = bbox.x - x
let diffY = bbox.y - y
x += x - diffX
y += y - diffY
}
bbox.x = x
bbox.y = y
return self
}
})
}
static Filter () {
let layer = this.domNode
let style = layer.style
return {
update (RenderObject) {
let filter = ''
for (let p in RenderObject) {
if (!cache.filter[p]) continue
if (cache.filter[p]) {
filter += ` ${p}( ${RenderObject[p]})`
}
}
if (filter) {
style.webkitFilter = style.filter = filter
}
}
}
}
static Scroll () {
let layer = this.domNode
return {
update: (RenderObject) => {
for (let p in RenderObject) {
if (!cache.scroll[p]) continue
layer[p] = RenderObject[p]
}
}
}
}
}
const Store = {
add: function (tween) {
if (Store[tween] && JSON.stringify(tween) && JSON.stringify(Store[tween])) {
return Store[tween];
}
Store[tween] = tween;
return tween
}
};
add: function (tween) {
if (Store[tween] && JSON.stringify(tween) && JSON.stringify(Store[tween])) {
return Store[tween]
}
export default Store;
Store[tween] = tween
return tween
}
}
export default Store

@@ -1,5 +0,5 @@

import toNumber from './toNumber';
import toNumber from './toNumber'
let colorMatch = /rgb|hsl|hsv/g;
let isIncrementReqForColor = /ahsv|ahsl|argb/g;
let colorMatch = /rgb|hsl|hsv/g
let isIncrementReqForColor = /ahsv|ahsl|argb/g

@@ -9,97 +9,103 @@ // Credits:

// Optimized, Extended by @dalisoft
const Number_Match_RegEx =
/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi;
let hexColor = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i;
const numRegExp =
/\s+|([A-Za-z?().,{}:""[\]#]+)|([-+/*%]+=)?([-+*/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g
let hexColor = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i
let hexReplace = (all, hex) => {
let r
let g
let 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}`;
let r
let g
let 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}`
}
const SubTween = (start, end, roundv = 10000) => {
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] : SubTween(start[i], v));
let endIndex = startIndex !== null ? startIndex + 6 : null;
if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {
startIndex++;
endIndex++;
}
let map = [...start];
return (t) => {
for ( let i = 0, length = end.length; i < length; i++ ) {
let 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 (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]) : SubTween(start[i], v))
let endIndex = startIndex !== null ? startIndex + 6 : null
if (isColorPropsExist && isIncrementReqForColor.test(isColorPropsExist)) {
startIndex++
endIndex++
}
if (startIndex !== null && i > startIndex && i < endIndex) {
map[i] = map[i] | 0;
}
let map = [...start]
return (t) => {
for (let i = 0, v, 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
}
}
return map;
}
} else if (typeof start === "object") {
for ( let 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] === "string" ) {
end[property] = SubTween(start[property], end[property]);
}
}
let map = {...start};
return (t) => {
for ( let property in end ) {
let to = end[property];
if ( typeof to === "function" ) {
map[property] = to(t);
} else if (typeof to === "number") {
map[property] = (((start[property] + to * t) * roundv) | 0) / roundv;
}
}
return map;
}
} else if (typeof start === "number") {
end -= start;
let isSame = start === end;
return (t) => {
return isSame ? end : (((start + end * t) * roundv) | 0) / roundv;
}
} else if (typeof start === "string") {
let _startMap = start.replace(hexColor, hexReplace).match(Number_Match_RegEx).map(toNumber);
let _endMap = end.replace(hexColor, hexReplace).match(Number_Match_RegEx).map(toNumber);
let _tween = SubTween(_startMap, _endMap);
return (t) => {
let _t = _tween(t);
let i = 0;
let s = '';
while (i < _t.length) {
s += _t[i];
i++
}
return s
}
} else if (typeof end === "function") {
return end;
} else {
let isSame = start === end;
return (t) => isSame ? start : t >= 0.5 ? end : start;
}
if (startIndex !== null && i > startIndex && i < endIndex) {
map[i] = map[i] | 0
}
}
}
return map
}
} else if (typeof start === 'object') {
for (let 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] === 'string') {
end[property] = SubTween(start[property], end[property])
}
}
let map = {...start}
return (t) => {
for (let property in end) {
let to = end[property]
if (typeof to === 'function') {
map[property] = to(t)
} else if (typeof to === 'number') {
map[property] = (((start[property] + to * t) * roundv) | 0) / roundv
}
}
return map
}
} else if (typeof start === 'number') {
end -= start
let isSame = start === end
return (t) => {
return isSame ? end : (((start + end * t) * roundv) | 0) / roundv
}
} else if (typeof start === 'string') {
let _startMap = start.replace(hexColor, hexReplace).match(numRegExp).map(toNumber)
let _endMap = end.replace(hexColor, hexReplace).match(numRegExp).map(toNumber)
let _tween = SubTween(_startMap, _endMap)
return (t) => {
let _t = _tween(t)
let i = 0
let s = ''
while (i < _t.length) {
s += _t[i]
i++
}
return s
}
} else if (typeof end === 'function') {
return end
} else {
let isSame = start === end
return (t) => isSame ? start : t >= 0.5 ? end : start
}
}
export default SubTween;
export default SubTween

@@ -1,102 +0,96 @@

import Tween from './Tween';
import { now, nextId } from './core';
import Tween from './Tween'
import { add, now, nextId } from './core'
class Timeline extends Tween {
constructor(params) {
super();
this._totalDuration = 0;
this._startTime = now();
this._tweens = {};
this._elapsed = 0;
this._id = nextId();
this._labels = {};
this._defaultParams = params;
constructor (params) {
super()
this._totalDuration = 0
this._startTime = now()
this._tweens = {}
this._elapsed = 0
this._id = nextId()
this._labels = {}
this._defaultParams = params
return this;
return this
}
setLabel(name, value) {
this._labels[name] = this.parsePosition(0, value, 0);
return this;
setLabel (name, value) {
this._labels[name] = this.parsePosition(0, value, 0)
return this
}
parsePosition(startTime, input, total) {
let position = startTime + total;
if (typeof input === "string") {
parsePosition (startTime, input, total) {
let position = startTime + total
if (typeof input === 'string') {
for (let label in this._labels) {
if (input.indexOf(label) === 0) {
let inp = input.split(label)[1]
let inp = input.split(label)[1];
if (inp.length === 0 || (inp[0] === '+' || inp[0] === '-')) {
position = this._labels[label] + startTime;
input = input.replace(label, '');
position = this._labels[label] + startTime
input = input.replace(label, '')
}
}
}
if (input.indexOf('+') === 0 || input.indexOf('-') === 0) {
position += parseFloat(input);
position += parseFloat(input)
}
} else if (typeof input === "number") {
position += input;
} else if (typeof input === 'number') {
position += input
}
return position;
return position
}
map(fn) {
map (fn) {
for (let tween in this._tweens) {
fn(this._tweens[tween]);
fn(this._tweens[tween])
}
return this;
return this
}
add(tween, position) {
if (typeof tween === "object" && !(tween instanceof Tween)) {
add (tween, position) {
if (typeof tween === 'object' && !(tween instanceof Tween)) {
tween = new Tween(tween.from, tween)
}
tween = new Tween(tween.from, tweens)
}
let {
_defaultParams,
_totalDuration
} = this;
} = this
if (_defaultParams) {
for (let method in _defaultParams) {
tween[method](_defaultParams[method]);
tween[method](_defaultParams[method])
}
}
tween._startTime = this.parsePosition(0, position, _totalDuration);
tween._startTime += now();
this._totalDuration = Math.max(_totalDuration, tween._duration + tween._startTime);
this._tweens[tween.id] = tween;
return this;
tween._startTime = this.parsePosition(0, position, _totalDuration)
tween._startTime += now()
this._totalDuration = Math.max(_totalDuration, tween._duration + tween._startTime)
this._tweens[tween.id] = tween
return this
}
restart () {
this._startTime += now();
this._startTime += now()
add(this);
add(this)
return this.emit('restart');
return this.emit('restart')
}
easing(easing) {
return this.map(tween => tween.easing(easing));
easing (easing) {
return this.map(tween => tween.easing(easing))
}
interpolation(interpolation) {
return this.map(tween => tween.interpolation(interpolation));
interpolation (interpolation) {
return this.map(tween => tween.interpolation(interpolation))
}
update(time) {
update (time) {
let {

@@ -111,78 +105,74 @@ _tweens,

_repeat
} = this;
} = this
if (time < _startTime) {
return true;
return true
}
let elapsed = Math.min(1, Math.max(0, (time - _startTime) / _totalDuration));
elapsed = _reversed ? 1 - elapsed : elapsed;
this._elapsed = elapsed;
let elapsed = Math.min(1, Math.max(0, (time - _startTime) / _totalDuration))
elapsed = _reversed ? 1 - elapsed : elapsed
this._elapsed = elapsed
let timing = time - _startTime;
let _timing = _reversed ? _totalDuration - timing : timing;
let timing = time - _startTime
let _timing = _reversed ? _totalDuration - timing : timing
for (let tween in _tweens) {
let _tween = _tweens[tween];
let _tween = _tweens[tween]
if (_tween.skip || _tween.update(_timing)) {
continue;
continue
} else {
_tween.skip = true;
}
_tween.skip = true
}
}
this.emit('update', elapsed, timing);
this.emit('update', elapsed, timing)
if (elapsed === 1 || (_reversed && elapsed === 0)) {
if (_repeat) {
if (isFinite(_repeat)) {
this._repeat--;
this._repeat--
}
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? 'reverse' : 'repeat');
this.emit(_reversed ? 'reverse' : 'repeat')
if (_yoyo) {
this._reversed = !_reversed;
this._reversed = !_reversed
}
if (!_reversed && _repeatDelayTime) {
this._startTime += _totalDuration + _repeatDelayTime;
this._startTime += _totalDuration + _repeatDelayTime
} else if (_reversed && _reverseDelayTime) {
this._startTime += _totalDuration + _reverseDelayTime;
this._startTime += _totalDuration + _reverseDelayTime
} else {
this._startTime += _totalDuration;
this._startTime += _totalDuration
}
for (let tween in _tweens) {
let _tween = _tweens[tween];
if (_tween.skip) {
_tween.skip = false;
}
}
return true;
for (let tween in _tweens) {
let _tween = _tweens[tween]
if (_tween.skip) {
_tween.skip = false
}
}
return true
} else {
this.emit('complete')
this._repeat = this._r
this.emit('complete');
this._repeat = this._r;
return false;
return false
}
}
return true;
return true
}
elapsed (value) {
return value !== undefined ? this.update(value * this._totalDuration) : this._elapsed
}
elapsed(value) {
return value !== undefined ? this.update(value * this._totalDuration) : this._elapsed;
seek (value) {
return this.update(value < 1.1 ? value * this._totalDuration : value)
}
}
export default Timeline;
export default Timeline

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

export default function toNumber(val) {
let floatedVal = parseFloat(val);
return typeof floatedVal === "number" && !isNaN(floatedVal) ? floatedVal : val;
export default function toNumber (val) {
let floatedVal = parseFloat(val)
return typeof floatedVal === 'number' && !isNaN(floatedVal) ? floatedVal : val
}

@@ -7,213 +7,156 @@ import {

}
from './core';
import Easing from './Easing';
import Interpolation from './Interpolation';
import toNumber from './toNumber';
import SubTween from './SubTween';
import Store from './Store';
const maxDecNum = 10000;
from './core'
import Easing from './Easing'
import Interpolation from './Interpolation'
import SubTween from './SubTween'
import Store from './Store'
import EventClass from './Event'
const defaultEasing = Easing.Linear.None
class Tween {
constructor(object = {}, instate) {
// Events list
const EVENT_UPDATE = 'update'
const EVENT_COMPLETE = 'complete'
const EVENT_START = 'start'
const EVENT_REPEAT = 'repeat'
const EVENT_REVERSE = 'reverse'
const EVENT_PAUSE = 'pause'
const EVENT_PLAY = 'play'
const EVENT_RS = 'restart'
const EVENT_STOP = 'stop'
const EVENT_SEEK = 'seek'
this.isJoinToString = typeof object === "string";
this.object = object;
this._valuesStart = Tween.createEmptyConst(object);
this._valuesEnd = Tween.createEmptyConst(object);
class Tween extends EventClass {
constructor (object = {}, instate) {
super()
this._duration = 1000;
this._easingFunction = defaultEasing;
this._interpolationFunction = Interpolation.None;
this.isJoinToString = typeof object === 'string'
this.object = object
this._valuesStart = Tween.createEmptyConst(object)
this._valuesEnd = Tween.createEmptyConst(object)
this._startTime = 0;
this._delayTime = 0;
this._repeat = 0;
this._r = 0;
this._isPlaying = false;
this._yoyo = false;
this._reversed = false;
this._duration = 1000
this._easingFunction = defaultEasing
this._interpolationFunction = Interpolation.None
this._onStartCallbackFired = false;
this._pausedTime = null;
this.id = nextId();
this._startTime = 0
this._delayTime = 0
this._repeat = 0
this._r = 0
this._isPlaying = false
this._yoyo = false
this._reversed = false
this._onStartCallbackFired = false
this._pausedTime = null
this.id = nextId()
if (instate && instate.to) {
return new Tween(object)
.to(instate.to, instate);
.to(instate.to, instate)
}
return this;
return this
}
static createEmptyConst (oldObject) {
return typeof (oldObject) === 'number' ? 0 : Array.isArray(oldObject) ? [] : typeof (oldObject) === 'object' ? {}
: ''
}
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
}
static checkValidness(valid) {
return valid !== undefined && valid !== null && valid !== '' && valid !== NaN && valid !== Infinity;
isPlaying () {
return this._isPlaying
}
isPlaying() {
return this._isPlaying;
isStarted () {
return this._onStartCallbackFired
}
isStarted() {
return this._onStartCallbackFired;
}
reverse() {
reverse () {
const {
_reversed
} = this;
} = this
this._reversed = !_reversed;
this._reversed = !_reversed
return this;
return this
}
reversed() {
return this._reversed;
reversed () {
return this._reversed
}
useActiveMode () {
this.object = Store.add(this.object);
return this;
this.object = Store.add(this.object)
return this
}
off(name, fn) {
if (!(this._events && this._events[name] !== undefined)) {
return this;
}
if (name !== undefined && fn !== undefined) {
let eventsList = this._events[name],
i = 0;
while (i < eventsList.length) {
if (eventsList[i] === fn) {
eventsList.splice(i, 1);
}
i++;
}
} else if (name !== undefined && fn === undefined) {
this._events[name] = [];
}
return this;
}
on(name, fn) {
if (!(this._events && this._events[name] !== undefined)) {
if (!this._events) {
this._events = {};
}
this._events[name] = [];
}
this._events[name].push(fn);
return this;
}
once(name, fn) {
if (!(this._events && this._events[name] !== undefined)) {
if (!this._events) {
this._events = {};
}
this._events[name] = [];
}
return this.on(name, (...args) => {
fn.call(this, ...args);
this.off(name);
});
}
emit(name, a, b, c, d, e) {
let {
_events
} = this;
if (!_events) {
return this;
}
let eventFn = _events[name];
if (!eventFn) {
return this;
}
let i = eventFn.length;
while (i--) {
eventFn[i].call(this, a, b, c, d, e);
}
return this;
}
pause() {
pause () {
if (!this._isPlaying) {
return this;
return this
}
this._isPlaying = false;
this._isPlaying = false
remove(this);
this._pausedTime = now();
remove(this)
this._pausedTime = now()
return this.emit('pause', this.object);
return this.emit(EVENT_PAUSE, this.object)
}
play() {
play () {
if (this._isPlaying) {
return this;
return this
}
this._isPlaying = true;
this._isPlaying = true
this._startTime += now() - this._pausedTime;
add(this);
this._pausedTime = now();
this._startTime += now() - this._pausedTime
add(this)
this._pausedTime = now()
return this.emit('play', this.object);
return this.emit(EVENT_PLAY, this.object)
}
restart(noDelay) {
this._repeat = this._r;
this._startTime = now() + (noDelay ? 0 : this._delayTime);
restart (noDelay) {
this._repeat = this._r
this._startTime = now() + (noDelay ? 0 : this._delayTime)
if (!this._isPlaying) {
add(this);
add(this)
}
return this.emit('restart', this._object);
return this.emit(EVENT_RS, this._object)
}
seek(time, keepPlaying) {
seek (time, keepPlaying) {
this._startTime = now() + Math.max(0, Math.min(
time, this._duration));
time, this._duration))
this.emit('seek', time, this._object);
this.emit(EVENT_SEEK, time, this._object)
return keepPlaying ? this : this.pause();
return keepPlaying ? this : this.pause()
}
duration(amount) {
this._duration = typeof(amount) === "function" ? amount(this._duration) : amount;
duration (amount) {
this._duration = typeof (amount) === 'function' ? amount(this._duration) : amount
return this;
return this
}
to(properties = {}, duration = 1000) {
if (typeof properties === "number") {
let _vE = {
Number: properties
};
this._valuesEnd = _vE;
} else if (typeof properties === "string" && this.isJoinToString) {
this._valuesEnd = SubTween(this.object, properties);
} else {
this._valuesEnd = properties;
}
to (properties = {}, duration = 1000) {
if (typeof properties === 'object') {
this._valuesEnd = properties
}
if (typeof duration === "number") {
this._duration = typeof(duration) === "function" ? duration(this._duration) : duration;
} else if (typeof duration === "object") {
if (typeof duration === 'number') {
this._duration = typeof (duration) === 'function' ? duration(this._duration) : duration
} else if (typeof duration === 'object') {
for (let prop in duration) {
if (this[prop]) {
this[prop](...(Array.isArray(duration) ? duration : [duration]));
this[prop](...(Array.isArray(duration) ? duration : [duration]))
}

@@ -223,151 +166,133 @@ }

return this;
return this
}
render() {
render () {
if (this._rendered) {
return this
}
let {
_startTime,
_delayTime,
_valuesEnd,
_valuesStart,
object
} = this;
} = this
if (typeof _valuesEnd === "object") {
for (let property in _valuesEnd) {
if (typeof _valuesEnd[property] === 'object' && _valuesEnd[property]) {
this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property])
this.object[property] = this._valuesEnd[property](0)
} else if (typeof _valuesEnd[property] === 'string' && typeof object[property] === 'string') {
this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property])
this.object[property] = this._valuesEnd[property](0)
}
for (let property in _valuesEnd) {
// 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
}
if (typeof _valuesEnd[property] === "object" && _valuesEnd[property]) {
this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
this.object[property] = this._valuesEnd[property](0)
} else if (typeof _valuesEnd[property] === "string" && typeof object[property] === "string") {
this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
this.object[property] = this._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;
}
// If duplicate or non-tweening numerics matched,
// we should skip from adding to _valuesStart
if (object[property] === _valuesEnd[property]) {
continue;
}
this._valuesStart[property] = object[property];
// If duplicate or non-tweening numerics matched,
// we should skip from adding to _valuesStart
if (object[property] === _valuesEnd[property]) {
continue
}
this._valuesStart[property] = object[property]
}
return this
}
start(time) {
this._startTime = time !== undefined ? time : now();
this._startTime += this._delayTime;
start (time) {
this._startTime = time !== undefined ? time : now()
this._startTime += this._delayTime
this.render();
this._rendered = true;
this.render()
this._rendered = true
add(this);
add(this)
this.emit('start', this.object);
this.emit(EVENT_START, this.object)
this._isPlaying = true;
this._isPlaying = true
return this;
return this
}
stop() {
stop () {
let {
_isPlaying,
object
} = this;
} = this
if (!_isPlaying) {
return this;
return this
}
remove(this);
this._isPlaying = false;
remove(this)
this._isPlaying = false
return this.emit('stop', object);
return this.emit(EVENT_STOP, object)
}
end() {
end () {
const {
_startTime,
_duration
} = this;
} = this
return this.update(_startTime + _duration);
return this.update(_startTime + _duration)
}
delay(amount) {
this._delayTime = typeof(amount) === "function" ? amount(this._delayTime) : amount;
this._startTime += this._delayTime;
delay (amount) {
this._delayTime = typeof (amount) === 'function' ? amount(this._delayTime) : amount
this._startTime += this._delayTime
return this;
return this
}
repeat(amount) {
this._repeat = typeof(amount) === "function" ? amount(this._repeat) : amount;
this._r = this._repeat;
repeat (amount) {
this._repeat = typeof (amount) === 'function' ? amount(this._repeat) : amount
this._r = this._repeat
return this;
return this
}
repeatDelay(amount) {
this._repeatDelayTime = typeof(amount) === "function" ? amount(this._repeatDelayTime) : amount;
repeatDelay (amount) {
this._repeatDelayTime = typeof (amount) === 'function' ? amount(this._repeatDelayTime) : amount
return this;
return this
}
reverseDelay(amount) {
this._reverseDelayTime = typeof(amount) === "function" ? amount(this._reverseDelayTime) : amount;
reverseDelay (amount) {
this._reverseDelayTime = typeof (amount) === 'function' ? amount(this._reverseDelayTime) : amount
return this;
return this
}
yoyo(state) {
this._yoyo = typeof(state) === "function" ? state(this._yoyo) : state;
yoyo (state) {
this._yoyo = typeof (state) === 'function' ? state(this._yoyo) : state
return this;
return this
}
easing(fn) {
this._easingFunction = fn;
easing (fn) {
this._easingFunction = fn
return this;
return this
}
interpolation(fn) {
this._interpolationFunction = fn;
interpolation (fn) {
this._interpolationFunction = fn
return this;
return this
}
get (time) {
this.update(time)
return this.object
}
get(time) {
this.update(time);
return this.object;
}
update(time) {
update (time) {
let {

@@ -380,3 +305,2 @@ _onStartCallbackFired,

_reverseDelayTime,
_delayTime,
_yoyo,

@@ -388,130 +312,107 @@ _reversed,

_valuesEnd,
object,
isJoinToString
} = this;
object
} = this
let property;
let elapsed;
let value;
let property
let elapsed
let value
time = time !== undefined ? time : now();
time = time !== undefined ? time : now()
if (time < _startTime) {
return true;
return true
}
if (!_onStartCallbackFired) {
if (!this._rendered) {
this.render()
if (!this._rendered) {
this.emit(EVENT_START, object)
this.render();
this._rendered = true
}
this.emit('start', object);
this._rendered = true;
}
this._onStartCallbackFired = true;
this._onStartCallbackFired = true
}
elapsed = (time - _startTime) / _duration;
elapsed = elapsed > 1 ? 1 : elapsed;
elapsed = _reversed ? 1 - elapsed : elapsed;
elapsed = (time - _startTime) / _duration
elapsed = elapsed > 1 ? 1 : elapsed
elapsed = _reversed ? 1 - elapsed : elapsed
value = typeof _easingFunction === "function" ? _easingFunction(elapsed) : defaultEasing(elapsed);
value = typeof _easingFunction === 'function' ? _easingFunction(elapsed) : defaultEasing(elapsed)
if (typeof _valuesEnd === "function") {
for (property in _valuesEnd) {
// Don't update properties that do not exist in the source object
if (_valuesStart[property] === undefined) {
continue
}
this.emit('update', _valuesEnd(elapsed), value, elapsed);
let start = _valuesStart[property]
let end = _valuesEnd[property]
value = _easingFunction[property] ? _easingFunction[property](elapsed) : value
} else {
for (property in _valuesEnd) {
// Don't update properties that do not exist in the source object
if (_valuesStart[property] === undefined) {
continue;
if (typeof end === 'function') {
object[property] = end(value)
} else if (Array.isArray(end)) {
object[property] = _interpolationFunction(end, value)
} else if (typeof (end) === 'string') {
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
end = start + parseFloat(end)
} else {
end = parseFloat(end)
}
let start = _valuesStart[property];
let end = _valuesEnd[property];
value = _easingFunction[property] ? _easingFunction[property](elapsed) : value;
if (typeof end === "function") {
object[property] = end(value);
} else if (Array.isArray(end)) {
object[property] = _interpolationFunction(end, 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) * maxDecNum) | 0) / maxDecNum;
}
} else if (typeof(start) === 'number') {
object[property] = (((start + (end - start) * value) * maxDecNum) | 0) / maxDecNum;
// Protect against non numeric properties.
if (typeof (end) === 'number') {
object[property] = start + (end - start) * value
}
} else if (typeof (start) === 'number') {
object[property] = start + (end - start) * value
}
}
this.emit('update', object, value, elapsed);
this.emit(EVENT_UPDATE, object, value, elapsed)
}
this.object = object
if (elapsed === 1 || (_reversed && elapsed === 0)) {
if (_repeat) {
if (isFinite(_repeat)) {
this._repeat--;
this._repeat--
}
for (property in _valuesEnd) {
if (typeof(_valuesEnd[property]) === 'string' && typeof(_valuesStart[property]) === 'number') {
this._valuesStart[property] = _valuesStart[property] + parseFloat(_valuesEnd[property]);
if (typeof (_valuesEnd[property]) === 'string' && typeof (_valuesStart[property]) === 'number') {
this._valuesStart[property] = _valuesStart[property] + parseFloat(_valuesEnd[property])
}
}
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? 'reverse' : 'repeat', object);
this.emit(_reversed ? EVENT_REVERSE : EVENT_REPEAT, object)
if (_yoyo) {
this._reversed = !_reversed;
this._reversed = !_reversed
}
if (!_reversed && _repeatDelayTime) {
this._startTime += _duration + _repeatDelayTime;
this._startTime += _duration + _repeatDelayTime
} else if (_reversed && _reverseDelayTime) {
this._startTime += _duration + _reverseDelayTime;
this._startTime += _duration + _reverseDelayTime
} else {
this._startTime += _duration;
this._startTime += _duration
}
return true;
return true
} else {
this.emit(EVENT_COMPLETE, object)
this._repeat = this._r
this.emit('complete', object);
this._repeat = this._r;
return false;
return false
}
}
return true;
return true
}
}
export default Tween;
export default Tween

@@ -1,25 +0,9 @@

/* Shims will be deprecated in next update, please update browser */
import './shim/object_assign'
import './shim/raf'
import './shim/isArray'
import { nextId, has, get, getAll, removeAll, remove, add, now, update, autoPlay, on, once, off, emit } 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'
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 }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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