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.2.8 to 2.3.0

package-lock.json

1097

dist/Tween.js

@@ -744,3 +744,3 @@ (function (global, factory) {

var SubTween = function (start, end, roundv) {
if ( roundv === void 0 ) roundv = 100000;
if ( roundv === void 0 ) roundv = 10000;

@@ -795,509 +795,551 @@ if (Array.isArray(start)) {

var Store = {
add: function (tween) {
if (Store[tween] && JSON.stringify(tween) && JSON.stringify(Store[tween])) {
return Store[tween];
}
Store[tween] = tween;
return tween
}
};
// Credits:
// @jkroso for string parse library
// Optimized, Extended by @dalisoft
var Number_Match_RegEx = /\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi;
var Number_Match_RegEx =
/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi;
var maxDecNum = 10000;
var defaultEasing = Easing.Linear.None;
var Tween = function Tween(object, instate) {
if ( object === void 0 ) object = {};
if ( object === void 0 ) object = {};
this.isJoinToString = typeof object === "string" && Number_Match_RegEx.test(object);
object = this.isJoinToString ? object.match(Number_Match_RegEx).map(toNumber) : object;
this.object = object;
this._valuesStart = Tween.createEmptyConst(object);
this._valuesEnd = Tween.createEmptyConst(object);
this.isJoinToString = typeof object === "string" && Number_Match_RegEx.test(object);
object = this.isJoinToString ? object.match(Number_Match_RegEx)
.map(toNumber) : object;
this.object = object;
this._valuesStart = Tween.createEmptyConst(object);
this._valuesEnd = Tween.createEmptyConst(object);
this._duration = 1000;
this._easingFunction = Easing.Linear.None;
this._interpolationFunction = Interpolation.None;
this._duration = 1000;
this._easingFunction = defaultEasing;
this._interpolationFunction = Interpolation.None;
this._startTime = 0;
this._delayTime = 0;
this._repeat = 0;
this._r = null;
this._isPlaying = false;
this._yoyo = false;
this._reversed = null;
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();
this._onStartCallbackFired = false;
this._pausedTime = null;
this.id = nextId();
if (instate && instate.to) {
if (instate && instate.to) {
return new Tween(object).to(instate.to, instate);
return new Tween(object)
.to(instate.to, instate);
}
}
return this;
return this;
};
Tween.createEmptyConst = function createEmptyConst (oldObject) {
return typeof(oldObject) === "number" ? 0 : Array.isArray(oldObject) ? [] : typeof(oldObject) === "object" ? {} :
'';
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;
return valid !== undefined && valid !== null && valid !== '' && valid !== NaN && valid !== Infinity;
};
Tween.prototype.isPlaying = function isPlaying () {
return this._isPlaying;
return this._isPlaying;
};
Tween.prototype.isStarted = function isStarted () {
return this._onStartCallbackFired;
return this._onStartCallbackFired;
};
Tween.prototype.reverse = function reverse () {
var ref = this;
var _reversed = ref._reversed;
var ref = this;
var _reversed = ref._reversed;
this._reversed = !_reversed;
this._reversed = !_reversed;
return this;
return this;
};
Tween.prototype.reversed = function reversed () {
return this._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++;
}
} 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)) {
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++;
}
} 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.on(name, function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
if (!(this._events && this._events[name] !== undefined)) {
if (!this._events) {
this._events = {};
}
this._events[name] = [];
}
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;
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;
var ref = this;
var _events = ref._events;
var ref = this;
var _events = ref._events;
if (!_events) {
return this;
}
if (!_events) {
return this;
}
var eventFn = _events[name];
var eventFn = _events[name];
if (!eventFn) {
return this;
}
if (!eventFn) {
return this;
}
var i = eventFn.length;
while (i--) {
eventFn[i].call(this$1, a, b, c, d, e);
}
return this;
var i = eventFn.length;
while (i--) {
eventFn[i].call(this$1, a, b, c, d, e);
}
return this;
};
Tween.prototype.pause = function pause () {
};
Tween.prototype.pause = function pause () {
if (!this._isPlaying) {
return this;
}
if (!this._isPlaying) {
return this;
}
this._isPlaying = false;
this._isPlaying = false;
remove(this);
this._pausedTime = now$1();
remove(this);
this._pausedTime = now$1();
return this.emit('pause', this.object);
};
Tween.prototype.play = function play () {
return this.emit('pause', this.object);
};
Tween.prototype.play = function play () {
if (this._isPlaying) {
return this;
}
if (this._isPlaying) {
return this;
}
this._isPlaying = true;
this._isPlaying = true;
this._startTime += now$1() - this._pausedTime;
add(this);
this._pausedTime = now$1();
this._startTime += now$1() - this._pausedTime;
add(this);
this._pausedTime = now$1();
return this.emit('play', this.object);
};
Tween.prototype.restart = function restart (noDelay) {
return this.emit('play', this.object);
};
Tween.prototype.restart = function restart (noDelay) {
this._repeat = this._r;
this._startTime = now$1() + (noDelay ? 0 : this._delayTime);
this._repeat = this._r;
this._startTime = now$1() + (noDelay ? 0 : this._delayTime);
if (!this._isPlaying) {
add(this);
}
if (!this._isPlaying) {
add(this);
}
return this.emit('restart', this._object);
return this.emit('restart', this._object);
};
Tween.prototype.seek = function seek (time, keepPlaying) {
};
Tween.prototype.seek = function seek (time, keepPlaying) {
this._startTime = now$1() + Math.max(0, Math.min(
time, this._duration));
this._startTime = now$1() + Math.max(0, Math.min(
time, this._duration));
this.emit('seek', time, this._object);
this.emit('seek', time, this._object);
return keepPlaying ? this : this.pause();
return keepPlaying ? this : this.pause();
};
Tween.prototype.duration = function duration (amount) {
};
Tween.prototype.duration = function duration (amount) {
this._duration = typeof(amount) === "function" ? amount(this._duration) : amount;
this._duration = typeof(amount) === "function" ? amount(this._duration) : amount;
return this;
return this;
};
Tween.prototype.to = function to (properties, duration) {
var this$1 = this;
if ( properties === void 0 ) properties = {};
if ( duration === void 0 ) duration = 1000;
if (typeof properties === "number") {
var _vE = {
Number: properties
};
Tween.prototype.to = function to (properties, duration) {
var this$1 = this;
if ( properties === void 0 ) properties = {};
if ( duration === void 0 ) duration = 1000;
this._valuesEnd = _vE;
} else if (typeof properties === "string") {
this._valuesEnd = this.isJoinToString ? SubTween(this.object, properties.match(Number_Match_RegEx)
.map(toNumber)) : 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 properties === "number") {
var _vE = {
Number: properties
};
this._valuesEnd = _vE;
} else {
this._valuesEnd = this.isJoinToString ? SubTween(this.object, properties.match(Number_Match_RegEx).map(toNumber)) : properties;
}
return this;
var ref;
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]) {
this$1[prop](typeof duration[prop] === "function" ? duration[prop](this$1._duration) : duration);
}
}
}
};
Tween.prototype.render = function render () {
var this$1 = this;
return this;
};
Tween.prototype.start = function start (time) {
var this$1 = this;
var ref = this;
var _startTime = ref._startTime;
var _delayTime = ref._delayTime;
var _valuesEnd = ref._valuesEnd;
var _valuesStart = ref._valuesStart;
var object = ref.object;
if (typeof _valuesEnd === "object") {
var ref = this;
var _startTime = ref._startTime;
var _delayTime = ref._delayTime;
var _valuesEnd = ref._valuesEnd;
var _valuesStart = ref._valuesStart;
var object = ref.object;
for (var property in _valuesEnd) {
_startTime = time !== undefined ? time : now$1();
_startTime += _delayTime;
if (typeof _valuesEnd[property] === "object" && _valuesEnd[property]) {
this._startTime = _startTime;
this$1._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
this$1.object[property] = this$1._valuesEnd[property](0);
if (typeof _valuesEnd === "object") {
} else if (typeof _valuesEnd[property] === "string" && typeof object[property] === "string" &&
Number_Match_RegEx.test(object[property]) && Number_Match_RegEx.test(_valuesEnd[property])) {
for (var property in _valuesEnd) {
var _get__Start = object[property].match(Number_Match_RegEx);
_get__Start = _get__Start.map(toNumber);
var _get__End = _valuesEnd[property].match(Number_Match_RegEx);
_get__End = _get__End.map(toNumber);
if (typeof _valuesEnd[property] === "object" && _valuesEnd[property]) {
this$1._valuesEnd[property] = SubTween(_get__Start, _get__End);
this$1._valuesEnd[property].join = true;
this$1.object[property] = joinToString(this$1._valuesEnd[property](0));
this$1._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
}
} else if (typeof _valuesEnd[property] === "string" && typeof object[property] === "string" && Number_Match_RegEx.test(object[property]) && Number_Match_RegEx.test(_valuesEnd[property])) {
// 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;
}
var _get__Start = object[property].match(Number_Match_RegEx);
_get__Start = _get__Start.map(toNumber);
var _get__End = _valuesEnd[property].match(Number_Match_RegEx);
_get__End = _get__End.map(toNumber);
// If duplicate or non-tweening numerics matched,
// we should skip from adding to _valuesStart
if (object[property] === _valuesEnd[property]) {
continue;
}
this$1._valuesEnd[property] = SubTween(_get__Start, _get__End);
this$1._valuesEnd[property].join = true;
this$1._valuesStart[property] = object[property];
}
}
// 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;
}
};
Tween.prototype.start = function start (time) {
this$1._valuesStart[property] = object[property];
this._startTime = time !== undefined ? time : now$1();
this._startTime += this._delayTime;
}
this.render();
this._rendered = true;
}
add(this);
add(this);
this.emit('start', this.object);
this._isPlaying = true;
this._isPlaying = true;
return this;
return this;
};
Tween.prototype.stop = function stop () {
};
Tween.prototype.stop = function stop () {
var ref = this;
var _isPlaying = ref._isPlaying;
var object = ref.object;
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('stop', object);
};
Tween.prototype.end = function end () {
};
Tween.prototype.end = function end () {
var ref = this;
var _startTime = ref._startTime;
var _duration = ref._duration;
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._delayTime = typeof(amount) === "function" ? amount(this._delayTime) : amount;
this._startTime += this._delayTime;
return this;
return this;
};
Tween.prototype.repeat = function repeat (amount) {
};
Tween.prototype.repeat = function repeat (amount) {
this._repeat = typeof(amount) === "function" ? amount(this._repeat) : amount;
this._r = this._repeat;
this._repeat = typeof(amount) === "function" ? amount(this._repeat) : amount;
this._r = this._repeat;
return this;
return this;
};
Tween.prototype.repeatDelay = function repeatDelay (amount) {
};
Tween.prototype.repeatDelay = function repeatDelay (amount) {
this._repeatDelayTime = typeof(amount) === "function" ? amount(this._repeatDelayTime) : amount;
this._repeatDelayTime = typeof(amount) === "function" ? amount(this._repeatDelayTime) : amount;
return this;
return this;
};
Tween.prototype.reverseDelay = function reverseDelay (amount) {
};
Tween.prototype.reverseDelay = function reverseDelay (amount) {
this._reverseDelayTime = typeof(amount) === "function" ? amount(this._reverseDelayTime) : amount;
this._reverseDelayTime = typeof(amount) === "function" ? amount(this._reverseDelayTime) : amount;
return this;
return this;
};
Tween.prototype.yoyo = function yoyo (state) {
};
Tween.prototype.yoyo = function yoyo (state) {
this._yoyo = typeof(state) === "function" ? state(this._yoyo) : state;
this._yoyo = typeof(state) === "function" ? state(this._yoyo) : state;
return this;
return this;
};
Tween.prototype.easing = function easing (fn) {
};
Tween.prototype.easing = function easing (fn) {
this._easingFunction = fn;
this._easingFunction = fn;
return this;
return this;
};
Tween.prototype.interpolation = function interpolation (fn) {
};
Tween.prototype.interpolation = function interpolation (fn) {
this._interpolationFunction = fn;
this._interpolationFunction = fn;
return this;
return this;
};
Tween.prototype.get = function get$$1 (time) {
this.update(time);
return this.object;
};
Tween.prototype.update = function update$$1 (time) {
var this$1 = this;
};
Tween.prototype.get = function get$$1 (time) {
this.update(time);
return this.object;
};
Tween.prototype.update = function update$$1 (time) {
var this$1 = this;
var ref = this;
var _onStartCallbackFired = ref._onStartCallbackFired;
var _easingFunction = ref._easingFunction;
var _interpolationFunction = ref._interpolationFunction;
var _repeat = ref._repeat;
var _repeatDelayTime = ref._repeatDelayTime;
var _reverseDelayTime = ref._reverseDelayTime;
var _delayTime = ref._delayTime;
var _yoyo = ref._yoyo;
var _reversed = ref._reversed;
var _startTime = ref._startTime;
var _duration = ref._duration;
var _valuesStart = ref._valuesStart;
var _valuesEnd = ref._valuesEnd;
var object = ref.object;
var isJoinToString = ref.isJoinToString;
var ref = this;
var _onStartCallbackFired = ref._onStartCallbackFired;
var _easingFunction = ref._easingFunction;
var _interpolationFunction = ref._interpolationFunction;
var _repeat = ref._repeat;
var _repeatDelayTime = ref._repeatDelayTime;
var _reverseDelayTime = ref._reverseDelayTime;
var _delayTime = ref._delayTime;
var _yoyo = ref._yoyo;
var _reversed = ref._reversed;
var _startTime = ref._startTime;
var _duration = ref._duration;
var _valuesStart = ref._valuesStart;
var _valuesEnd = ref._valuesEnd;
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$1();
if (time < _startTime) {
return true;
}
if (time < _startTime) {
return true;
}
if (!_onStartCallbackFired) {
if (!_onStartCallbackFired) {
this.emit('start', object);
if (!this._rendered) {
this._onStartCallbackFired = true;
}
this.render();
elapsed = (time - _startTime) / _duration;
elapsed = elapsed > 1 ? 1 : elapsed;
elapsed = _reversed ? 1 - elapsed : elapsed;
this.emit('start', object);
value = _easingFunction(elapsed);
this._rendered = true;
if (typeof _valuesEnd === "function") {
}
var get$$1 = _valuesEnd(value);
this._onStartCallbackFired = true;
}
if (isJoinToString) {
elapsed = (time - _startTime) / _duration;
elapsed = elapsed > 1 ? 1 : elapsed;
elapsed = _reversed ? 1 - elapsed : elapsed;
get$$1 = joinToString(get$$1);
if (typeof _valuesEnd === "function") {
}
var get$$1 = _valuesEnd(value);
object = get$$1;
if (isJoinToString) {
} else {
get$$1 = joinToString(get$$1);
for (property in _valuesEnd) {
}
// Don't update properties that do not exist in the source object
if (_valuesStart[property] === undefined) {
continue;
}
object = get$$1;
var start = _valuesStart[property];
var end = _valuesEnd[property];
} else {
if (typeof end === "function") {
for (property in _valuesEnd) {
var get$1 = end(value);
// Don't update properties that do not exist in the source object
if (_valuesStart[property] === undefined) {
continue;
}
if (end.join) {
var start = _valuesStart[property];
var end = _valuesEnd[property];
value = _easingFunction[property] ? _easingFunction[property](elapsed) : typeof _easingFunction === "function" ? _easingFunction(elapsed) : defaultEasing(elapsed);
get$1 = joinToString(get$1);
if (typeof end === "function") {
}
var get$1 = end(value);
object[property] = get$1;
if (end.join) {
} else if (Array.isArray(end)) {
get$1 = joinToString(get$1);
object[property] = _interpolationFunction(end, value);
}
} else if (typeof(end) === 'string') {
object[property] = get$1;
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
end = start + parseFloat(end);
} else {
end = parseFloat(end);
}
} else if (Array.isArray(end)) {
// 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;
}
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;
}
this.emit('update', object, value, elapsed);
}
if (elapsed === 1 || (_reversed && elapsed === 0)) {
}
if (_repeat) {
this.emit('update', object, value, elapsed);
if (isFinite(_repeat)) {
this._repeat--;
}
if (elapsed === 1 || (_reversed && elapsed === 0)) {
for (property in _valuesEnd) {
if (_repeat) {
if (typeof(_valuesEnd[property]) === 'string' && typeof(_valuesStart[property]) === 'number') {
this$1._valuesStart[property] = _valuesStart[property] + parseFloat(_valuesEnd[property]);
}
if (isFinite(_repeat)) {
this._repeat--;
}
}
for (property in _valuesEnd) {
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? 'reverse' : 'repeat', object);
if (typeof(_valuesEnd[property]) === 'string' && typeof(_valuesStart[property]) === 'number') {
this$1._valuesStart[property] = _valuesStart[property] + parseFloat(_valuesEnd[property]);
}
if (_yoyo) {
this._reversed = !_reversed;
}
}
if (!_reversed && _repeatDelayTime) {
this._startTime += _duration + _repeatDelayTime;
} else if (_reversed && _reverseDelayTime) {
this._startTime += _duration + _reverseDelayTime;
} else {
this._startTime += _duration;
}
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? 'reverse' : 'repeat', object);
return true;
if (_yoyo) {
this._reversed = !_reversed;
}
} else {
if (!_reversed && _repeatDelayTime) {
this._startTime += _duration + _repeatDelayTime;
} else if (_reversed && _reverseDelayTime) {
this._startTime += _duration + _reverseDelayTime;
} else {
this._startTime += _duration;
}
this.emit('complete', object);
return true;
return false;
} else {
}
}
return true;
};
this.emit('complete', object);
this._repeat = this._r;
return false;
}
}
return true;
};
var cache = {

@@ -1330,3 +1372,6 @@ filter: {

skewX: 1,
skewY: 1
skewY: 1,
x: 1,
y: 1,
z: 1
}

@@ -1337,4 +1382,15 @@ };

Plugins.DOM = function DOM (Composite) {
var layer = Composite.domNode,
Plugins.Attr = function Attr (Composite) {
var layer = this.domNode;
return {
update: function update(Tween, RenderObject) {
for (var p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) { continue; }
layer.setAttribute(p, RenderObject[p]);
}
}
}
};
Plugins.Style = function Style () {
var layer = this.domNode,
style = layer.style;

@@ -1344,2 +1400,3 @@ return {

for (var p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) { continue; }
style[p] = RenderObject[p];

@@ -1350,4 +1407,4 @@ }

};
Plugins.Transform = function Transform (Composite) {
var layer = Composite.domNode,
Plugins.Transform = function Transform () {
var layer = this.domNode,
style = layer.style;

@@ -1358,2 +1415,3 @@ return {

for (var p in RenderObject) {
if (cache.filter[p]) { continue; }
if (p === 'x' || p === 'y' || p === 'z') {

@@ -1371,4 +1429,61 @@ transform += ' translate3d( ' + (RenderObject.x || '0px') + ', ' + (RenderObject.y || '0px') + ', ' + (RenderObject.z || '0px') + ')';

};
Plugins.Filter = function Filter (Composite) {
var layer = Composite.domNode,
Plugins.SVGTransform = function SVGTransform (xPos, yPos) {
var layer = this.domNode,
bbox = {};
return {
update: function update(Tween, RenderObject) {
var this$1 = this;
var transform = '';
for (var p in RenderObject) {
if (!cache.transform[p]) { continue; }
if (bbox.x === undefined || bbox.y === undefined) {
this$1.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('transform', transform);
}
return this;
},
init: function init(Tween, RenderObject) {
return this.setOrigin(xPos, yPos);
},
setOrigin: function setOrigin(x, y) {
var ref = layer.getBoundingClientRect();
var width = ref.width;
var height = ref.height;
var left = ref.left;
var top = ref.top;
x = typeof(x) === "number" ? left + x : typeof x === "string" && x.indexOf('%') > -1 ? left + (width * (parseFloat(x) / 100)) : left + (width / 2);
y = typeof(y) === "number" ? left + y : typeof y === "string" && y.indexOf('%') > -1 ? top + (height * (parseFloat(y) / 100)) : top + (height / 2);
if (bbox.x !== undefined && bbox.y !== undefined) {
x += x - diffX;
y += y - diffY;
}
bbox.x = x;
bbox.y = y;
return this;
}
}
};
Plugins.Filter = function Filter () {
var layer = this.domNode,
style = layer.style;

@@ -1379,2 +1494,3 @@ return {

for (var p in RenderObject) {
if (cache.transform[p]) { continue; }
if (cache.filter[p]) {

@@ -1390,4 +1506,4 @@ filter += " " + p + "( " + (RenderObject[p]) + ")";

};
Plugins.Scroll = function Scroll (Composite) {
var layer = Composite.domNode;
Plugins.Scroll = function Scroll () {
var layer = this.domNode;
return {

@@ -1408,62 +1524,52 @@ update: function (Tween, RenderObject) {

this.plugins = {};
var pluginList = this.plugins;
this.render = function (object) {
var this$1 = 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);
for (var p in pluginList) {
pluginList[p] && pluginList[p].update && pluginList[p].update(this$1, object);
}
return this;
};
this.fetch = function () {
return this;
};
Composite.prototype.map = function map (type, object) {
var this$1 = this;
var ref = this;
var plugins = ref.plugins;
if (Object.keys(this.object).length) {
for (var p in plugins) {
return this;
var plugin = plugins[p];
}
plugin && plugin[type] && plugin[type](this$1, object);
for (var p in pluginList) {
}
pluginList[p] && pluginList[p].fetch && pluginList[p].fetch(this$1);
return this;
};
Composite.prototype.render = function render (object) {
}
return this.map('update', object);
return this;
};
};
Composite.prototype.init = function init (object) {
this.init = function (object) {
var this$1 = this;
return this.map('init', object);
};
Composite.prototype.fetch = function fetch$1 (object) {
for (var p in pluginList) {
return this.map('fetch', fetch);
pluginList[p] && pluginList[p].init && pluginList[p].init(this$1, object);
}
return this;
};
return this;
};
Composite.prototype.applyPlugin = function applyPlugin (name) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
var prototypeAccessors = { object: {} };
Composite.prototype.applyPlugin = function applyPlugin (name) {
if (Plugins[name] !== undefined) {
this.plugins[name] = Plugins[name](this);
this.plugins[name] = Plugins[name].apply(this, args);
return this.plugins[name];
}
return this;
};
prototypeAccessors.object.set = function (obj) {
return this.render(obj);
};
Composite.prototype.appendTo = function appendTo (node) {

@@ -1474,41 +1580,181 @@ node.appendChild(this.domNode);

Object.defineProperties( Composite.prototype, prototypeAccessors );
var Timeline = (function (Tween$$1) {
function Timeline(params) {
Tween$$1.call(this);
this._totalDuration = 0;
this._startTime = now$1();
this._tweens = {};
this._elapsed = 0;
this._id = nextId();
this._labels = {};
this._defaultParams = params;
var Timeline = function Timeline () {
this._private = {
tweens: [],
fullTime: 0
};
return this;
};
Timeline.prototype.add = function add (tween) {
var this$1 = this;
return this;
}
if (tween instanceof Tween) {
this._private.tweens.push(tween);
} else if (!Array.isArray(tween) && typeof tween === "object") {
var tweenExample = new Tween({x:0});
for ( var p in tween ) {
tweenExample[p](tween[p]);
}
this.add(tweenExample);
} else if (typeof tween === "object") {
tween.map(function (add) {
this$1.add(add);
});
if ( Tween$$1 ) Timeline.__proto__ = Tween$$1;
Timeline.prototype = Object.create( Tween$$1 && Tween$$1.prototype );
Timeline.prototype.constructor = Timeline;
Timeline.prototype.setLabel = function setLabel (name, value) {
this._labels[name] = this.parsePosition(0, value, 0);
return this;
};
Timeline.prototype.parsePosition = function parsePosition (startTime, input, total) {
var this$1 = this;
var position = startTime + total;
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") {
position += input;
}
return position;
};
Timeline.prototype.map = function map (fn) {
var this$1 = this;
for (var tween in this$1._tweens) {
fn(this$1._tweens[tween]);
}
return this;
};
Timeline.prototype.add = function add$$1 (tween, position) {
if (typeof tween === "object" && !(tween instanceof Tween$$1)) {
tween = new Tween$$1(tween.from, tweens);
}
return this;
};
Timeline.prototype.start = function start () {
var this$1 = this;
this._private.tweens.map(function (tween) {
tween.start(this$1._private.fullTime);
});
this._private.fullTime = Math.max.apply(0, this._private.tweens.reduce(function (prev, curr) {
return curr._duration > prev ? curr._duration : prev;
}, 0));
return this;
};
var ref = this;
var _defaultParams = ref._defaultParams;
var _totalDuration = ref._totalDuration;
if (_defaultParams) {
for (var method in _defaultParams) {
tween[method](_defaultParams[method]);
}
}
tween._startTime = this.parsePosition(0, position, _totalDuration);
tween._startTime += now$1();
this._totalDuration = Math.max(_totalDuration, tween._duration + tween._startTime);
this._tweens[tween.id] = tween;
return this;
};
Timeline.prototype.easing = function 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); });
};
Timeline.prototype.update = function update$$1 (time) {
var this$1 = this;
var ref = this;
var _tweens = ref._tweens;
var _totalDuration = ref._totalDuration;
var _repeatDelayTime = ref._repeatDelayTime;
var _reverseDelayTime = ref._reverseDelayTime;
var _startTime = ref._startTime;
var _reversed = ref._reversed;
var _yoyo = ref._yoyo;
var _repeat = ref._repeat;
if (time < _startTime) {
return true;
}
var elapsed = Math.min(1, Math.max(0, (time - _startTime) / _totalDuration));
elapsed = _reversed ? 1 - elapsed : elapsed;
this._elapsed = elapsed;
var timing = time - _startTime;
timing = _reversed ? _totalDuration - timing : timing;
for (var tween in _tweens) {
if (_tweens[tween].update(timing)) {
continue;
} else {
delete this$1._tweens[tween];
}
}
this.emit('update', elapsed);
if (elapsed === 1 || (_reversed && elapsed === 0)) {
if (_repeat) {
if (isFinite(_repeat)) {
this._repeat--;
}
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? 'reverse' : 'repeat');
if (_yoyo) {
this._reversed = !_reversed;
}
if (!_reversed && _repeatDelayTime) {
this._startTime += _totalDuration + _repeatDelayTime;
} else if (_reversed && _reverseDelayTime) {
this._startTime += _totalDuration + _reverseDelayTime;
} else {
this._startTime += _totalDuration;
}
return true;
} else {
this.emit('complete');
this._repeat = this._r;
return false;
}
}
return true;
};
Timeline.prototype.elapsed = function elapsed (value) {
return value !== undefined ? this.update(value * this._totalDuration) : this._elapsed;
};
return Timeline;
}(Tween));
var lin = function (k) { return k; };

@@ -1533,2 +1779,3 @@

exports.TweenInit = TweenInit;
exports.nextId = nextId;
exports.has = has;

@@ -1535,0 +1782,0 @@ exports.get = get;

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

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

@@ -9,3 +9,3 @@ {

"name": "es6-tween",
"version": "2.2.8",
"version": "2.3.0",
"description": "ES6 implementation of amazing tween.js",

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

@@ -25,2 +25,7 @@ # es6-tween

## Demos
* Play at [Codepen](https://codepen.io/dalisoft/pen/mMJmxX)
## Installation

@@ -27,0 +32,0 @@

@@ -10,54 +10,46 @@ import Plugins from './Plugins';

this.plugins = {};
let pluginList = this.plugins;
this.render = function (object) {
this.map = this.map.bind(this);
this.render = this.render.bind(this);
this.init = this.init.bind(this);
this.fetch = this.fetch.bind(this);
for (let p in pluginList) {
return this;
}
map (type, object) {
let { plugins } = this;
pluginList[p] && pluginList[p].update && pluginList[p].update(this, object);
for (let p in plugins) {
}
let plugin = plugins[p];
return this;
};
plugin && plugin[type] && plugin[type](this, object);
this.fetch = function () {
}
if (Object.keys(this.object).length) {
return this;
}
render (object) {
return this;
return this.map('update', object);
}
}
init (object) {
for (let p in pluginList) {
return this.map('init', object);
pluginList[p] && pluginList[p].fetch && pluginList[p].fetch(this);
}
fetch (object) {
}
return this.map('fetch', fetch);
return this;
};
this.init = function (object) {
for (let p in pluginList) {
pluginList[p] && pluginList[p].init && pluginList[p].init(this, object);
}
return this;
}
return this;
}
applyPlugin(name) {
applyPlugin(name, ...args) {
if (Plugins[name] !== undefined) {
this.plugins[name] = Plugins[name](this);
this.plugins[name] = Plugins[name].apply(this, args);
return this.plugins[name];
}
return this;
}
set object(obj) {
return this.render(obj);
}
appendTo(node) {

@@ -64,0 +56,0 @@ node.appendChild(this.domNode);

@@ -28,3 +28,6 @@ const cache = {

skewX: 1,
skewY: 1
skewY: 1,
x: 1,
y: 1,
z: 1
}

@@ -34,4 +37,15 @@ };

export default class Plugins {
static DOM(Composite) {
let layer = Composite.domNode,
static Attr(Composite) {
let layer = this.domNode
return {
update(Tween, RenderObject) {
for (let p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) continue;
layer.setAttribute(p, RenderObject[p]);
}
}
}
}
static Style() {
let layer = this.domNode,
style = layer.style;

@@ -41,2 +55,3 @@ return {

for (let p in RenderObject) {
if (cache.transform[p] || cache.filter[p]) continue;
style[p] = RenderObject[p];

@@ -47,4 +62,4 @@ }

}
static Transform(Composite) {
let layer = Composite.domNode,
static Transform() {
let layer = this.domNode,
style = layer.style;

@@ -55,2 +70,3 @@ return {

for (let p in RenderObject) {
if (cache.filter[p]) continue;
if (p === 'x' || p === 'y' || p === 'z') {

@@ -68,4 +84,55 @@ transform += ' translate3d( ' + (RenderObject.x || '0px') + ', ' + (RenderObject.y || '0px') + ', ' + (RenderObject.z || '0px') + ')';

}
static Filter(Composite) {
let layer = Composite.domNode,
static SVGTransform(xPos, yPos) {
let layer = this.domNode,
bbox = {};
return {
update(Tween, RenderObject) {
let transform = '';
for (let p in RenderObject) {
if (!cache.transform[p]) continue;
if (bbox.x === undefined || bbox.y === undefined) {
this.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('transform', transform)
}
return this;
},
init(Tween, RenderObject) {
return this.setOrigin(xPos, yPos);
},
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) {
x += x - diffX;
y += y - diffY;
}
bbox.x = x;
bbox.y = y;
return this;
}
}
}
static Filter() {
let layer = this.domNode,
style = layer.style;

@@ -76,2 +143,3 @@ return {

for (let p in RenderObject) {
if (cache.transform[p]) continue;
if (cache.filter[p]) {

@@ -87,4 +155,4 @@ filter += ` ${ p }( ${ RenderObject[p] })`;

}
static Scroll(Composite) {
let layer = Composite.domNode;
static Scroll() {
let layer = this.domNode;
return {

@@ -91,0 +159,0 @@ update: (Tween, RenderObject) => {

@@ -1,2 +0,2 @@

const SubTween = (start, end, roundv = 100000) => {
const SubTween = (start, end, roundv = 10000) => {
if (Array.isArray(start)) {

@@ -3,0 +3,0 @@ end = end.map((v, i) => v === start[i] ? null : typeof v === "number" ? v - start[i] : typeof v === "string" ? v : SubTween(start[i], v));

import Tween from './Tween';
import { now, nextId } from './core';
export default class Timeline {
constructor () {
this._private = {
tweens: [],
fullTime: 0
};
return this;
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;
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") {
for (let label in this._labels) {
if (input.indexOf(label) === 0) {
let inp = input.split(label)[1];
if (inp.length === 0 || (inp[0] === '+' || inp[0] === '-')) {
position = this._labels[label] + startTime;
input = input.replace(label, '');
}
}
}
if (input.indexOf('+') === 0 || input.indexOf('-') === 0) {
position += parseFloat(input);
}
} else if (typeof input === "number") {
position += input;
}
return position;
}
map(fn) {
for (let tween in this._tweens) {
fn(this._tweens[tween]);
}
return this;
}
add(tween, position) {
if (typeof tween === "object" && !(tween instanceof Tween)) {
tween = new Tween(tween.from, tweens)
}
add (tween) {
if (tween instanceof Tween) {
this._private.tweens.push(tween);
} else if (!Array.isArray(tween) && typeof tween === "object") {
let tweenExample = new Tween({x:0});
for ( let p in tween ) {
tweenExample[p](tween[p]);
}
this.add(tweenExample)
} else if (typeof tween === "object") {
tween.map(add => {
this.add(add);
});
}
return this;
}
start () {
this._private.tweens.map(tween => {
tween.start(this._private.fullTime);
});
this._private.fullTime = Math.max.apply(0, this._private.tweens.reduce((prev, curr) => {
return curr._duration > prev ? curr._duration : prev;
}, 0));
return this;
}
};
let {
_defaultParams,
_totalDuration
} = this;
if (_defaultParams) {
for (let method in _defaultParams) {
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;
}
easing(easing) {
return this.map(tween => tween.easing(easing));
}
interpolation(interpolation) {
return this.map(tween => tween.interpolation(interpolation));
}
update(time) {
let {
_tweens,
_totalDuration,
_repeatDelayTime,
_reverseDelayTime,
_startTime,
_reversed,
_yoyo,
_repeat
} = this;
if (time < _startTime) {
return true;
}
let elapsed = Math.min(1, Math.max(0, (time - _startTime) / _totalDuration));
elapsed = _reversed ? 1 - elapsed : elapsed;
this._elapsed = elapsed;
let timing = time - _startTime;
timing = _reversed ? _totalDuration - timing : timing;
for (let tween in _tweens) {
if (_tweens[tween].update(timing)) {
continue;
} else {
delete this._tweens[tween];
}
}
this.emit('update', elapsed);
if (elapsed === 1 || (_reversed && elapsed === 0)) {
if (_repeat) {
if (isFinite(_repeat)) {
this._repeat--;
}
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? 'reverse' : 'repeat');
if (_yoyo) {
this._reversed = !_reversed;
}
if (!_reversed && _repeatDelayTime) {
this._startTime += _totalDuration + _repeatDelayTime;
} else if (_reversed && _reverseDelayTime) {
this._startTime += _totalDuration + _reverseDelayTime;
} else {
this._startTime += _totalDuration;
}
return true;
} else {
this.emit('complete');
this._repeat = this._r;
return false;
}
}
return true;
}
elapsed(value) {
return value !== undefined ? this.update(value * this._totalDuration) : this._elapsed;
}
}
export default Timeline;
import {
add,
remove,
now,
nextId
add,
remove,
now,
nextId
}

@@ -13,2 +13,3 @@ from './core';

import SubTween from './SubTween';
import Store from './Store';

@@ -18,497 +19,528 @@ // Credits:

// Optimized, Extended by @dalisoft
const Number_Match_RegEx = /\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi;
const Number_Match_RegEx =
/\s+|([A-Za-z?().,{}:""\[\]#]+)|([-+\/*%]+=)?([-+*\/%]+)?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/gi;
const maxDecNum = 10000;
const defaultEasing = Easing.Linear.None
class Tween {
constructor(object = {}, instate) {
constructor(object = {}, instate) {
this.isJoinToString = typeof object === "string" && Number_Match_RegEx.test(object);
object = this.isJoinToString ? object.match(Number_Match_RegEx).map(toNumber) : object;
this.object = object;
this._valuesStart = Tween.createEmptyConst(object);
this._valuesEnd = Tween.createEmptyConst(object);
this.isJoinToString = typeof object === "string" && Number_Match_RegEx.test(object);
object = this.isJoinToString ? object.match(Number_Match_RegEx)
.map(toNumber) : object;
this.object = object;
this._valuesStart = Tween.createEmptyConst(object);
this._valuesEnd = Tween.createEmptyConst(object);
this._duration = 1000;
this._easingFunction = Easing.Linear.None;
this._interpolationFunction = Interpolation.None;
this._duration = 1000;
this._easingFunction = defaultEasing;
this._interpolationFunction = Interpolation.None;
this._startTime = 0;
this._delayTime = 0;
this._repeat = 0;
this._r = null;
this._isPlaying = false;
this._yoyo = false;
this._reversed = null;
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();
this._onStartCallbackFired = false;
this._pausedTime = null;
this.id = nextId();
if (instate && instate.to) {
if (instate && instate.to) {
return new Tween(object).to(instate.to, instate);
return new Tween(object)
.to(instate.to, instate);
}
}
return this;
return this;
}
static createEmptyConst(oldObject) {
return typeof(oldObject) === "number" ? 0 : Array.isArray(oldObject) ? [] : typeof(oldObject) === "object" ? {} :
'';
}
static checkValidness(valid) {
return valid !== undefined && valid !== null && valid !== '' && valid !== NaN && valid !== Infinity;
}
isPlaying() {
return this._isPlaying;
}
isStarted() {
return this._onStartCallbackFired;
}
reverse() {
const {
_reversed
} = this;
this._reversed = !_reversed;
return this;
}
reversed() {
return this._reversed;
}
useActiveMode () {
this.object = Store.add(this.object);
return this;
}
off(name, fn) {
if (!(this._events && this._events[name] !== undefined)) {
return this;
}
static createEmptyConst(oldObject) {
return typeof(oldObject) === "number" ? 0 : Array.isArray(oldObject) ? [] : typeof(oldObject) === "object" ? {} :
'';
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] = [];
}
static checkValidness(valid) {
return valid !== undefined && valid !== null && valid !== '' && valid !== NaN && valid !== Infinity;
return this;
}
on(name, fn) {
if (!(this._events && this._events[name] !== undefined)) {
if (!this._events) {
this._events = {};
}
this._events[name] = [];
}
isPlaying() {
return this._isPlaying;
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] = [];
}
isStarted() {
return this._onStartCallbackFired;
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;
}
reverse() {
const {
_reversed
} = this;
let eventFn = _events[name];
this._reversed = !_reversed;
if (!eventFn) {
return this;
}
return this;
let i = eventFn.length;
while (i--) {
eventFn[i].call(this, a, b, c, d, e);
}
reversed() {
return this._reversed;
}
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) {
return this;
let {
_events
} = this;
}
pause() {
if (!_events) {
return this;
}
if (!this._isPlaying) {
return this;
}
let eventFn = _events[name];
this._isPlaying = false;
if (!eventFn) {
return this;
}
remove(this);
this._pausedTime = now();
let i = eventFn.length;
while (i--) {
eventFn[i].call(this, a, b, c, d, e);
}
return this;
return this.emit('pause', this.object);
}
play() {
}
pause() {
if (this._isPlaying) {
return this;
}
if (!this._isPlaying) {
return this;
}
this._isPlaying = true;
this._isPlaying = false;
this._startTime += now() - this._pausedTime;
add(this);
this._pausedTime = now();
remove(this);
this._pausedTime = now();
return this.emit('play', this.object);
}
restart(noDelay) {
return this.emit('pause', this.object);
}
play() {
this._repeat = this._r;
this._startTime = now() + (noDelay ? 0 : this._delayTime);
if (this._isPlaying) {
return this;
}
if (!this._isPlaying) {
add(this);
}
this._isPlaying = true;
return this.emit('restart', this._object);
this._startTime += now() - this._pausedTime;
add(this);
this._pausedTime = now();
}
seek(time, keepPlaying) {
return this.emit('play', this.object);
}
restart(noDelay) {
this._startTime = now() + Math.max(0, Math.min(
time, this._duration));
this._repeat = this._r;
this._startTime = now() + (noDelay ? 0 : this._delayTime);
this.emit('seek', time, this._object);
if (!this._isPlaying) {
add(this);
}
return keepPlaying ? this : this.pause();
return this.emit('restart', this._object);
}
duration(amount) {
}
seek(time, keepPlaying) {
this._duration = typeof(amount) === "function" ? amount(this._duration) : amount;
this._startTime = now() + Math.max(0, Math.min(
time, this._duration));
return this;
}
to(properties = {}, duration = 1000) {
this.emit('seek', time, this._object);
if (typeof properties === "number") {
let _vE = {
Number: properties
};
this._valuesEnd = _vE;
} else if (typeof properties === "string") {
this._valuesEnd = this.isJoinToString ? SubTween(this.object, properties.match(Number_Match_RegEx)
.map(toNumber)) : properties;
} else {
this._valuesEnd = properties;
}
return keepPlaying ? this : this.pause();
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]));
}
duration(amount) {
}
}
this._duration = typeof(amount) === "function" ? amount(this._duration) : amount;
return this;
return this;
}
to(properties = {}, duration = 1000) {
}
render() {
if (typeof properties === "number") {
let _vE = {
Number: properties
};
this._valuesEnd = _vE;
} else {
this._valuesEnd = this.isJoinToString ? SubTween(this.object, properties.match(Number_Match_RegEx).map(toNumber)) : properties;
}
let {
_startTime,
_delayTime,
_valuesEnd,
_valuesStart,
object
} = this;
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](typeof duration[prop] === "function" ? duration[prop](this._duration) : duration);
}
}
}
if (typeof _valuesEnd === "object") {
return this;
for (let property in _valuesEnd) {
}
start(time) {
if (typeof _valuesEnd[property] === "object" && _valuesEnd[property]) {
let {
_startTime,
_delayTime,
_valuesEnd,
_valuesStart,
object
} = this;
this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
this.object[property] = this._valuesEnd[property](0)
_startTime = time !== undefined ? time : now();
_startTime += _delayTime;
} else if (typeof _valuesEnd[property] === "string" && typeof object[property] === "string" &&
Number_Match_RegEx.test(object[property]) && Number_Match_RegEx.test(_valuesEnd[property])) {
this._startTime = _startTime;
let __get__Start = object[property].match(Number_Match_RegEx);
__get__Start = __get__Start.map(toNumber);
let __get__End = _valuesEnd[property].match(Number_Match_RegEx);
__get__End = __get__End.map(toNumber);
if (typeof _valuesEnd === "object") {
this._valuesEnd[property] = SubTween(__get__Start, __get__End);
this._valuesEnd[property].join = true;
this.object[property] = joinToString(this._valuesEnd[property](0))
for (let property in _valuesEnd) {
}
if (typeof _valuesEnd[property] === "object" && _valuesEnd[property]) {
// If `to()` specifies a property that doesn't exist in the source object,
// we should not set that property in the object
if (Tween.checkValidness(object[property]) === false) {
continue;
}
this._valuesEnd[property] = SubTween(object[property], _valuesEnd[property]);
// If duplicate or non-tweening numerics matched,
// we should skip from adding to _valuesStart
if (object[property] === _valuesEnd[property]) {
continue;
}
} else if (typeof _valuesEnd[property] === "string" && typeof object[property] === "string" && Number_Match_RegEx.test(object[property]) && Number_Match_RegEx.test(_valuesEnd[property])) {
this._valuesStart[property] = object[property];
let __get__Start = object[property].match(Number_Match_RegEx);
__get__Start = __get__Start.map(toNumber);
let __get__End = _valuesEnd[property].match(Number_Match_RegEx);
__get__End = __get__End.map(toNumber);
}
this._valuesEnd[property] = SubTween(__get__Start, __get__End);
this._valuesEnd[property].join = true;
}
}
}
start(time) {
// If `to()` specifies a property that doesn't exist in the source object,
// we should not set that property in the object
if (Tween.checkValidness(object[property]) === false) {
continue;
}
this._startTime = time !== undefined ? time : now();
this._startTime += this._delayTime;
// If duplicate or non-tweening numerics matched,
// we should skip from adding to _valuesStart
if (object[property] === _valuesEnd[property]) {
continue;
}
this.render();
this._rendered = true;
this._valuesStart[property] = object[property];
add(this);
}
this.emit('start', this.object);
}
this._isPlaying = true;
add(this);
return this;
this._isPlaying = true;
}
stop() {
return this;
let {
_isPlaying,
object
} = this;
}
stop() {
if (!_isPlaying) {
return this;
}
let {
_isPlaying,
object
} = this;
remove(this);
this._isPlaying = false;
if (!_isPlaying) {
return this;
}
return this.emit('stop', object);
remove(this);
this._isPlaying = false;
}
end() {
return this.emit('stop', object);
const {
_startTime,
_duration
} = this;
}
end() {
return this.update(_startTime + _duration);
const {
_startTime,
_duration
} = this;
}
delay(amount) {
return this.update(_startTime + _duration);
this._delayTime = typeof(amount) === "function" ? amount(this._delayTime) : amount;
this._startTime += this._delayTime;
}
delay(amount) {
return this;
this._delayTime = typeof(amount) === "function" ? amount(this._delayTime) : amount;
}
repeat(amount) {
return this;
this._repeat = typeof(amount) === "function" ? amount(this._repeat) : amount;
this._r = this._repeat;
}
repeat(amount) {
return this;
this._repeat = typeof(amount) === "function" ? amount(this._repeat) : amount;
this._r = this._repeat;
}
repeatDelay(amount) {
return this;
this._repeatDelayTime = typeof(amount) === "function" ? amount(this._repeatDelayTime) : amount;
}
repeatDelay(amount) {
return this;
this._repeatDelayTime = typeof(amount) === "function" ? amount(this._repeatDelayTime) : amount;
}
reverseDelay(amount) {
return this;
this._reverseDelayTime = typeof(amount) === "function" ? amount(this._reverseDelayTime) : amount;
}
reverseDelay(amount) {
return this;
this._reverseDelayTime = typeof(amount) === "function" ? amount(this._reverseDelayTime) : amount;
}
yoyo(state) {
return this;
this._yoyo = typeof(state) === "function" ? state(this._yoyo) : state;
}
yoyo(state) {
return this;
this._yoyo = typeof(state) === "function" ? state(this._yoyo) : state;
}
easing(fn) {
return this;
this._easingFunction = fn;
}
easing(fn) {
return this;
this._easingFunction = fn;
}
interpolation(fn) {
return this;
this._interpolationFunction = fn;
}
interpolation(fn) {
return this;
this._interpolationFunction = fn;
}
get(time) {
this.update(time);
return this.object;
}
update(time) {
return this;
let {
_onStartCallbackFired,
_easingFunction,
_interpolationFunction,
_repeat,
_repeatDelayTime,
_reverseDelayTime,
_delayTime,
_yoyo,
_reversed,
_startTime,
_duration,
_valuesStart,
_valuesEnd,
object,
isJoinToString
} = this;
}
get(time) {
this.update(time);
return this.object;
}
update(time) {
let property;
let elapsed;
let value;
let {
_onStartCallbackFired,
_easingFunction,
_interpolationFunction,
_repeat,
_repeatDelayTime,
_reverseDelayTime,
_delayTime,
_yoyo,
_reversed,
_startTime,
_duration,
_valuesStart,
_valuesEnd,
object,
isJoinToString
} = this;
time = time !== undefined ? time : now();
let property;
let elapsed;
let value;
if (time < _startTime) {
return true;
}
time = time !== undefined ? time : now();
if (!_onStartCallbackFired) {
if (time < _startTime) {
return true;
}
if (!this._rendered) {
if (!_onStartCallbackFired) {
this.render();
this.emit('start', object);
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 = _easingFunction(elapsed);
this._onStartCallbackFired = true;
}
if (typeof _valuesEnd === "function") {
elapsed = (time - _startTime) / _duration;
elapsed = elapsed > 1 ? 1 : elapsed;
elapsed = _reversed ? 1 - elapsed : elapsed;
let get = _valuesEnd(value);
if (typeof _valuesEnd === "function") {
if (isJoinToString) {
let get = _valuesEnd(value);
get = joinToString(get);
if (isJoinToString) {
}
get = joinToString(get);
object = get;
}
} else {
object = get;
for (property in _valuesEnd) {
} else {
// Don't update properties that do not exist in the source object
if (_valuesStart[property] === undefined) {
continue;
}
for (property in _valuesEnd) {
let start = _valuesStart[property];
let end = _valuesEnd[property];
// Don't update properties that do not exist in the source object
if (_valuesStart[property] === undefined) {
continue;
}
if (typeof end === "function") {
let start = _valuesStart[property];
let end = _valuesEnd[property];
value = _easingFunction[property] ? _easingFunction[property](elapsed) : typeof _easingFunction === "function" ? _easingFunction(elapsed) : defaultEasing(elapsed);
let get = end(value);
if (typeof end === "function") {
if (end.join) {
let get = end(value);
get = joinToString(get);
if (end.join) {
}
get = joinToString(get);
object[property] = get;
}
} else if (Array.isArray(end)) {
object[property] = get;
object[property] = _interpolationFunction(end, value);
} else if (Array.isArray(end)) {
} else if (typeof(end) === 'string') {
object[property] = _interpolationFunction(end, value);
if (end.charAt(0) === '+' || end.charAt(0) === '-') {
end = start + parseFloat(end);
} else {
end = parseFloat(end);
}
} else if (typeof(end) === 'string') {
// 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;
}
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;
}
}
}
this.emit('update', object, value, elapsed);
}
if (elapsed === 1 || (_reversed && elapsed === 0)) {
this.emit('update', object, value, elapsed);
if (_repeat) {
if (elapsed === 1 || (_reversed && elapsed === 0)) {
if (isFinite(_repeat)) {
this._repeat--;
}
if (_repeat) {
for (property in _valuesEnd) {
if (isFinite(_repeat)) {
this._repeat--;
}
if (typeof(_valuesEnd[property]) === 'string' && typeof(_valuesStart[property]) === 'number') {
this._valuesStart[property] = _valuesStart[property] + parseFloat(_valuesEnd[property]);
}
for (property in _valuesEnd) {
}
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);
}
if (_yoyo) {
this._reversed = !_reversed;
}
// Reassign starting values, restart by making startTime = now
this.emit(_reversed ? 'reverse' : 'repeat', object);
if (!_reversed && _repeatDelayTime) {
this._startTime += _duration + _repeatDelayTime;
} else if (_reversed && _reverseDelayTime) {
this._startTime += _duration + _reverseDelayTime;
} else {
this._startTime += _duration;
}
if (_yoyo) {
this._reversed = !_reversed;
}
return true;
if (!_reversed && _repeatDelayTime) {
this._startTime += _duration + _repeatDelayTime;
} else if (_reversed && _reverseDelayTime) {
this._startTime += _duration + _reverseDelayTime;
} else {
this._startTime += _duration;
}
} else {
return true;
this.emit('complete', object);
} else {
return false;
this.emit('complete', object);
this._repeat = this._r;
}
}
return true;
}
return false;
}
}
return true;
}
}
export default Tween;
export default Tween;

@@ -9,3 +9,3 @@ /* Shims will be deprecated in next update, please update browser */

import { has, get, getAll, removeAll, remove, add, now, update, autoPlay, on, once, off, emit } from './dist/core'
import { nextId, has, get, getAll, removeAll, remove, add, now, update, autoPlay, on, once, off, emit } from './dist/core'

@@ -26,2 +26,2 @@ import Easing from './dist/Easing'

export { TweenInit, has, get, getAll, removeAll, remove, add, now, update, autoPlay, on, once, off, emit, Tween, Easing, Interpolation, Composite, Timeline, Plugins }
export { TweenInit, nextId, has, get, getAll, removeAll, remove, add, now, update, autoPlay, on, once, off, emit, Tween, Easing, Interpolation, Composite, Timeline, Plugins }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc