From 351810c1b1a4e2701a274229ae5ea9694a34c696 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Sun, 2 Apr 2023 16:42:46 -0700 Subject: [PATCH] v19.0.0 --- dist/tween.amd.js | 133 +++++++++++++++++++++++---------- dist/tween.cjs.js | 133 +++++++++++++++++++++++---------- dist/tween.d.ts | 183 +++++++++++++++------------------------------- dist/tween.esm.js | 133 +++++++++++++++++++++++---------- dist/tween.umd.js | 133 +++++++++++++++++++++++---------- package-lock.json | 4 +- package.json | 2 +- src/Version.ts | 2 +- 8 files changed, 441 insertions(+), 282 deletions(-) diff --git a/dist/tween.amd.js b/dist/tween.amd.js index 256dd33a..b9a7e542 100644 --- a/dist/tween.amd.js +++ b/dist/tween.amd.js @@ -3,13 +3,22 @@ define(['exports'], function (exports) { 'use strict'; /** * The Ease class provides a collection of easing functions for use with tween.js. */ - var Easing = { - Linear: { + var Easing = Object.freeze({ + Linear: Object.freeze({ None: function (amount) { return amount; }, - }, - Quadratic: { + In: function (amount) { + return this.None(amount); + }, + Out: function (amount) { + return this.None(amount); + }, + InOut: function (amount) { + return this.None(amount); + }, + }), + Quadratic: Object.freeze({ In: function (amount) { return amount * amount; }, @@ -22,8 +31,8 @@ define(['exports'], function (exports) { 'use strict'; } return -0.5 * (--amount * (amount - 2) - 1); }, - }, - Cubic: { + }), + Cubic: Object.freeze({ In: function (amount) { return amount * amount * amount; }, @@ -36,8 +45,8 @@ define(['exports'], function (exports) { 'use strict'; } return 0.5 * ((amount -= 2) * amount * amount + 2); }, - }, - Quartic: { + }), + Quartic: Object.freeze({ In: function (amount) { return amount * amount * amount * amount; }, @@ -50,8 +59,8 @@ define(['exports'], function (exports) { 'use strict'; } return -0.5 * ((amount -= 2) * amount * amount * amount - 2); }, - }, - Quintic: { + }), + Quintic: Object.freeze({ In: function (amount) { return amount * amount * amount * amount * amount; }, @@ -64,19 +73,19 @@ define(['exports'], function (exports) { 'use strict'; } return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2); }, - }, - Sinusoidal: { + }), + Sinusoidal: Object.freeze({ In: function (amount) { - return 1 - Math.cos((amount * Math.PI) / 2); + return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2); }, Out: function (amount) { return Math.sin((amount * Math.PI) / 2); }, InOut: function (amount) { - return 0.5 * (1 - Math.cos(Math.PI * amount)); + return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount))); }, - }, - Exponential: { + }), + Exponential: Object.freeze({ In: function (amount) { return amount === 0 ? 0 : Math.pow(1024, amount - 1); }, @@ -95,8 +104,8 @@ define(['exports'], function (exports) { 'use strict'; } return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2); }, - }, - Circular: { + }), + Circular: Object.freeze({ In: function (amount) { return 1 - Math.sqrt(1 - amount * amount); }, @@ -109,8 +118,8 @@ define(['exports'], function (exports) { 'use strict'; } return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1); }, - }, - Elastic: { + }), + Elastic: Object.freeze({ In: function (amount) { if (amount === 0) { return 0; @@ -142,15 +151,15 @@ define(['exports'], function (exports) { 'use strict'; } return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1; }, - }, - Back: { + }), + Back: Object.freeze({ In: function (amount) { var s = 1.70158; - return amount * amount * ((s + 1) * amount - s); + return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s); }, Out: function (amount) { var s = 1.70158; - return --amount * amount * ((s + 1) * amount + s) + 1; + return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1; }, InOut: function (amount) { var s = 1.70158 * 1.525; @@ -159,8 +168,8 @@ define(['exports'], function (exports) { 'use strict'; } return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2); }, - }, - Bounce: { + }), + Bounce: Object.freeze({ In: function (amount) { return 1 - Easing.Bounce.Out(1 - amount); }, @@ -184,8 +193,27 @@ define(['exports'], function (exports) { 'use strict'; } return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5; }, + }), + generatePow: function (power) { + if (power === void 0) { power = 4; } + power = power < Number.EPSILON ? Number.EPSILON : power; + power = power > 10000 ? 10000 : power; + return { + In: function (amount) { + return Math.pow(amount, power); + }, + Out: function (amount) { + return 1 - Math.pow((1 - amount), power); + }, + InOut: function (amount) { + if (amount < 0.5) { + return Math.pow((amount * 2), power) / 2; + } + return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5; + }, + }; }, - }; + }); var now; // Include a performance.now polyfill. @@ -398,8 +426,10 @@ define(['exports'], function (exports) { 'use strict'; this._startTime = 0; this._easingFunction = Easing.Linear.None; this._interpolationFunction = Interpolation.Linear; + // eslint-disable-next-line this._chainedTweens = []; this._onStartCallbackFired = false; + this._onEveryStartCallbackFired = false; this._id = Sequence.nextId(); this._isChainStopped = false; this._goToEnd = false; @@ -425,10 +455,13 @@ define(['exports'], function (exports) { 'use strict'; return this; }; Tween.prototype.duration = function (d) { + if (d === void 0) { d = 1000; } this._duration = d; return this; }; - Tween.prototype.start = function (time) { + Tween.prototype.start = function (time, overrideStartingValues) { + if (time === void 0) { time = now$1(); } + if (overrideStartingValues === void 0) { overrideStartingValues = false; } if (this._isPlaying) { return this; } @@ -447,13 +480,17 @@ define(['exports'], function (exports) { 'use strict'; this._isPlaying = true; this._isPaused = false; this._onStartCallbackFired = false; + this._onEveryStartCallbackFired = false; this._isChainStopped = false; - this._startTime = time !== undefined ? (typeof time === 'string' ? now$1() + parseFloat(time) : time) : now$1(); + this._startTime = time; this._startTime += this._delayTime; - this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat); + this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues); return this; }; - Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) { + Tween.prototype.startFromCurrentValues = function (time) { + return this.start(time, true); + }; + Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) { for (var property in _valuesEnd) { var startValue = _object[property]; var startValueIsArray = Array.isArray(startValue); @@ -473,7 +510,9 @@ define(['exports'], function (exports) { 'use strict'; // handle an array of relative values endValues = endValues.map(this._handleRelativeValue.bind(this, startValue)); // Create a local copy of the Array with the start value at the front - _valuesEnd[property] = [startValue].concat(endValues); + if (_valuesStart[property] === undefined) { + _valuesEnd[property] = [startValue].concat(endValues); + } } // handle the deepness of the values if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) { @@ -487,11 +526,11 @@ define(['exports'], function (exports) { 'use strict'; _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values? // eslint-disable-next-line // @ts-ignore FIXME? - this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]); + this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues); } else { - // Save the starting value, but only once. - if (typeof _valuesStart[property] === 'undefined') { + // Save the starting value, but only once unless override is requested. + if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) { _valuesStart[property] = startValue; } if (!startValueIsArray) { @@ -562,14 +601,17 @@ define(['exports'], function (exports) { 'use strict'; return this; }; Tween.prototype.group = function (group) { + if (group === void 0) { group = mainGroup; } this._group = group; return this; }; Tween.prototype.delay = function (amount) { + if (amount === void 0) { amount = 0; } this._delayTime = amount; return this; }; Tween.prototype.repeat = function (times) { + if (times === void 0) { times = 0; } this._initialRepeat = times; this._repeat = times; return this; @@ -579,17 +621,21 @@ define(['exports'], function (exports) { 'use strict'; return this; }; Tween.prototype.yoyo = function (yoyo) { + if (yoyo === void 0) { yoyo = false; } this._yoyo = yoyo; return this; }; Tween.prototype.easing = function (easingFunction) { + if (easingFunction === void 0) { easingFunction = Easing.Linear.None; } this._easingFunction = easingFunction; return this; }; Tween.prototype.interpolation = function (interpolationFunction) { + if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; } this._interpolationFunction = interpolationFunction; return this; }; + // eslint-disable-next-line Tween.prototype.chain = function () { var tweens = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -602,6 +648,10 @@ define(['exports'], function (exports) { 'use strict'; this._onStartCallback = callback; return this; }; + Tween.prototype.onEveryStart = function (callback) { + this._onEveryStartCallback = callback; + return this; + }; Tween.prototype.onUpdate = function (callback) { this._onUpdateCallback = callback; return this; @@ -635,7 +685,7 @@ define(['exports'], function (exports) { 'use strict'; if (time > endTime) return false; if (autoStart) - this.start(time); + this.start(time, true); } this._goToEnd = false; if (time < this._startTime) { @@ -647,6 +697,12 @@ define(['exports'], function (exports) { 'use strict'; } this._onStartCallbackFired = true; } + if (this._onEveryStartCallbackFired === false) { + if (this._onEveryStartCallback) { + this._onEveryStartCallback(this._object); + } + this._onEveryStartCallbackFired = true; + } elapsed = (time - this._startTime) / this._duration; elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed; var value = this._easingFunction(elapsed); @@ -685,6 +741,7 @@ define(['exports'], function (exports) { 'use strict'; if (this._onRepeatCallback) { this._onRepeatCallback(this._object); } + this._onEveryStartCallbackFired = false; return true; } else { @@ -694,7 +751,7 @@ define(['exports'], function (exports) { 'use strict'; for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) { // Make the chained tweens start exactly at the time they should, // even if the `update()` method was called way past the duration of the tween - this._chainedTweens[i].start(this._startTime + this._duration); + this._chainedTweens[i].start(this._startTime + this._duration, false); } this._isPlaying = false; return false; @@ -758,7 +815,7 @@ define(['exports'], function (exports) { 'use strict'; return Tween; }()); - var VERSION = '18.6.4'; + var VERSION = '19.0.0'; /** * Tween.js - Licensed under the MIT license diff --git a/dist/tween.cjs.js b/dist/tween.cjs.js index 6b4d73d1..6d8a61cf 100644 --- a/dist/tween.cjs.js +++ b/dist/tween.cjs.js @@ -5,13 +5,22 @@ Object.defineProperty(exports, '__esModule', { value: true }); /** * The Ease class provides a collection of easing functions for use with tween.js. */ -var Easing = { - Linear: { +var Easing = Object.freeze({ + Linear: Object.freeze({ None: function (amount) { return amount; }, - }, - Quadratic: { + In: function (amount) { + return this.None(amount); + }, + Out: function (amount) { + return this.None(amount); + }, + InOut: function (amount) { + return this.None(amount); + }, + }), + Quadratic: Object.freeze({ In: function (amount) { return amount * amount; }, @@ -24,8 +33,8 @@ var Easing = { } return -0.5 * (--amount * (amount - 2) - 1); }, - }, - Cubic: { + }), + Cubic: Object.freeze({ In: function (amount) { return amount * amount * amount; }, @@ -38,8 +47,8 @@ var Easing = { } return 0.5 * ((amount -= 2) * amount * amount + 2); }, - }, - Quartic: { + }), + Quartic: Object.freeze({ In: function (amount) { return amount * amount * amount * amount; }, @@ -52,8 +61,8 @@ var Easing = { } return -0.5 * ((amount -= 2) * amount * amount * amount - 2); }, - }, - Quintic: { + }), + Quintic: Object.freeze({ In: function (amount) { return amount * amount * amount * amount * amount; }, @@ -66,19 +75,19 @@ var Easing = { } return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2); }, - }, - Sinusoidal: { + }), + Sinusoidal: Object.freeze({ In: function (amount) { - return 1 - Math.cos((amount * Math.PI) / 2); + return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2); }, Out: function (amount) { return Math.sin((amount * Math.PI) / 2); }, InOut: function (amount) { - return 0.5 * (1 - Math.cos(Math.PI * amount)); + return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount))); }, - }, - Exponential: { + }), + Exponential: Object.freeze({ In: function (amount) { return amount === 0 ? 0 : Math.pow(1024, amount - 1); }, @@ -97,8 +106,8 @@ var Easing = { } return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2); }, - }, - Circular: { + }), + Circular: Object.freeze({ In: function (amount) { return 1 - Math.sqrt(1 - amount * amount); }, @@ -111,8 +120,8 @@ var Easing = { } return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1); }, - }, - Elastic: { + }), + Elastic: Object.freeze({ In: function (amount) { if (amount === 0) { return 0; @@ -144,15 +153,15 @@ var Easing = { } return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1; }, - }, - Back: { + }), + Back: Object.freeze({ In: function (amount) { var s = 1.70158; - return amount * amount * ((s + 1) * amount - s); + return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s); }, Out: function (amount) { var s = 1.70158; - return --amount * amount * ((s + 1) * amount + s) + 1; + return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1; }, InOut: function (amount) { var s = 1.70158 * 1.525; @@ -161,8 +170,8 @@ var Easing = { } return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2); }, - }, - Bounce: { + }), + Bounce: Object.freeze({ In: function (amount) { return 1 - Easing.Bounce.Out(1 - amount); }, @@ -186,8 +195,27 @@ var Easing = { } return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5; }, + }), + generatePow: function (power) { + if (power === void 0) { power = 4; } + power = power < Number.EPSILON ? Number.EPSILON : power; + power = power > 10000 ? 10000 : power; + return { + In: function (amount) { + return Math.pow(amount, power); + }, + Out: function (amount) { + return 1 - Math.pow((1 - amount), power); + }, + InOut: function (amount) { + if (amount < 0.5) { + return Math.pow((amount * 2), power) / 2; + } + return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5; + }, + }; }, -}; +}); var now; // Include a performance.now polyfill. @@ -400,8 +428,10 @@ var Tween = /** @class */ (function () { this._startTime = 0; this._easingFunction = Easing.Linear.None; this._interpolationFunction = Interpolation.Linear; + // eslint-disable-next-line this._chainedTweens = []; this._onStartCallbackFired = false; + this._onEveryStartCallbackFired = false; this._id = Sequence.nextId(); this._isChainStopped = false; this._goToEnd = false; @@ -427,10 +457,13 @@ var Tween = /** @class */ (function () { return this; }; Tween.prototype.duration = function (d) { + if (d === void 0) { d = 1000; } this._duration = d; return this; }; - Tween.prototype.start = function (time) { + Tween.prototype.start = function (time, overrideStartingValues) { + if (time === void 0) { time = now$1(); } + if (overrideStartingValues === void 0) { overrideStartingValues = false; } if (this._isPlaying) { return this; } @@ -449,13 +482,17 @@ var Tween = /** @class */ (function () { this._isPlaying = true; this._isPaused = false; this._onStartCallbackFired = false; + this._onEveryStartCallbackFired = false; this._isChainStopped = false; - this._startTime = time !== undefined ? (typeof time === 'string' ? now$1() + parseFloat(time) : time) : now$1(); + this._startTime = time; this._startTime += this._delayTime; - this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat); + this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues); return this; }; - Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) { + Tween.prototype.startFromCurrentValues = function (time) { + return this.start(time, true); + }; + Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) { for (var property in _valuesEnd) { var startValue = _object[property]; var startValueIsArray = Array.isArray(startValue); @@ -475,7 +512,9 @@ var Tween = /** @class */ (function () { // handle an array of relative values endValues = endValues.map(this._handleRelativeValue.bind(this, startValue)); // Create a local copy of the Array with the start value at the front - _valuesEnd[property] = [startValue].concat(endValues); + if (_valuesStart[property] === undefined) { + _valuesEnd[property] = [startValue].concat(endValues); + } } // handle the deepness of the values if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) { @@ -489,11 +528,11 @@ var Tween = /** @class */ (function () { _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values? // eslint-disable-next-line // @ts-ignore FIXME? - this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]); + this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues); } else { - // Save the starting value, but only once. - if (typeof _valuesStart[property] === 'undefined') { + // Save the starting value, but only once unless override is requested. + if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) { _valuesStart[property] = startValue; } if (!startValueIsArray) { @@ -564,14 +603,17 @@ var Tween = /** @class */ (function () { return this; }; Tween.prototype.group = function (group) { + if (group === void 0) { group = mainGroup; } this._group = group; return this; }; Tween.prototype.delay = function (amount) { + if (amount === void 0) { amount = 0; } this._delayTime = amount; return this; }; Tween.prototype.repeat = function (times) { + if (times === void 0) { times = 0; } this._initialRepeat = times; this._repeat = times; return this; @@ -581,17 +623,21 @@ var Tween = /** @class */ (function () { return this; }; Tween.prototype.yoyo = function (yoyo) { + if (yoyo === void 0) { yoyo = false; } this._yoyo = yoyo; return this; }; Tween.prototype.easing = function (easingFunction) { + if (easingFunction === void 0) { easingFunction = Easing.Linear.None; } this._easingFunction = easingFunction; return this; }; Tween.prototype.interpolation = function (interpolationFunction) { + if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; } this._interpolationFunction = interpolationFunction; return this; }; + // eslint-disable-next-line Tween.prototype.chain = function () { var tweens = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -604,6 +650,10 @@ var Tween = /** @class */ (function () { this._onStartCallback = callback; return this; }; + Tween.prototype.onEveryStart = function (callback) { + this._onEveryStartCallback = callback; + return this; + }; Tween.prototype.onUpdate = function (callback) { this._onUpdateCallback = callback; return this; @@ -637,7 +687,7 @@ var Tween = /** @class */ (function () { if (time > endTime) return false; if (autoStart) - this.start(time); + this.start(time, true); } this._goToEnd = false; if (time < this._startTime) { @@ -649,6 +699,12 @@ var Tween = /** @class */ (function () { } this._onStartCallbackFired = true; } + if (this._onEveryStartCallbackFired === false) { + if (this._onEveryStartCallback) { + this._onEveryStartCallback(this._object); + } + this._onEveryStartCallbackFired = true; + } elapsed = (time - this._startTime) / this._duration; elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed; var value = this._easingFunction(elapsed); @@ -687,6 +743,7 @@ var Tween = /** @class */ (function () { if (this._onRepeatCallback) { this._onRepeatCallback(this._object); } + this._onEveryStartCallbackFired = false; return true; } else { @@ -696,7 +753,7 @@ var Tween = /** @class */ (function () { for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) { // Make the chained tweens start exactly at the time they should, // even if the `update()` method was called way past the duration of the tween - this._chainedTweens[i].start(this._startTime + this._duration); + this._chainedTweens[i].start(this._startTime + this._duration, false); } this._isPlaying = false; return false; @@ -760,7 +817,7 @@ var Tween = /** @class */ (function () { return Tween; }()); -var VERSION = '18.6.4'; +var VERSION = '19.0.0'; /** * Tween.js - Licensed under the MIT license diff --git a/dist/tween.d.ts b/dist/tween.d.ts index ea216027..f2b3dae3 100644 --- a/dist/tween.d.ts +++ b/dist/tween.d.ts @@ -1,62 +1,28 @@ declare type EasingFunction = (amount: number) => number; +declare type EasingFunctionGroup = { + In: EasingFunction; + Out: EasingFunction; + InOut: EasingFunction; +}; /** * The Ease class provides a collection of easing functions for use with tween.js. */ -declare const Easing: { - Linear: { - None: (amount: number) => number; - }; - Quadratic: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Cubic: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Quartic: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Quintic: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Sinusoidal: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Exponential: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Circular: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Elastic: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Back: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Bounce: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; -}; +declare const Easing: Readonly<{ + Linear: Readonly; + Quadratic: Readonly; + Cubic: Readonly; + Quartic: Readonly; + Quintic: Readonly; + Sinusoidal: Readonly; + Exponential: Readonly; + Circular: Readonly; + Elastic: Readonly; + Back: Readonly; + Bounce: Readonly; + generatePow(power?: number): EasingFunctionGroup; +}>; /** * @@ -99,6 +65,8 @@ declare class Tween { private _chainedTweens; private _onStartCallback?; private _onStartCallbackFired; + private _onEveryStartCallback?; + private _onEveryStartCallbackFired; private _onUpdateCallback?; private _onRepeatCallback?; private _onCompleteCallback?; @@ -110,27 +78,29 @@ declare class Tween { isPlaying(): boolean; isPaused(): boolean; to(properties: UnknownProps, duration?: number): this; - duration(d: number): this; - start(time?: number): this; + duration(d?: number): this; + start(time?: number, overrideStartingValues?: boolean): this; + startFromCurrentValues(time?: number): this; private _setupProperties; stop(): this; end(): this; pause(time?: number): this; resume(time?: number): this; stopChainedTweens(): this; - group(group: Group): this; - delay(amount: number): this; - repeat(times: number): this; - repeatDelay(amount: number): this; - yoyo(yoyo: boolean): this; - easing(easingFunction: EasingFunction): this; - interpolation(interpolationFunction: InterpolationFunction): this; - chain(...tweens: Array>): this; - onStart(callback: (object: T) => void): this; - onUpdate(callback: (object: T, elapsed: number) => void): this; - onRepeat(callback: (object: T) => void): this; - onComplete(callback: (object: T) => void): this; - onStop(callback: (object: T) => void): this; + group(group?: Group): this; + delay(amount?: number): this; + repeat(times?: number): this; + repeatDelay(amount?: number): this; + yoyo(yoyo?: boolean): this; + easing(easingFunction?: EasingFunction): this; + interpolation(interpolationFunction?: InterpolationFunction): this; + chain(...tweens: Array>): this; + onStart(callback?: (object: T) => void): this; + onEveryStart(callback?: (object: T) => void): this; + onUpdate(callback?: (object: T, elapsed: number) => void): this; + onRepeat(callback?: (object: T) => void): this; + onComplete(callback?: (object: T) => void): this; + onStop(callback?: (object: T) => void): this; private _goToEnd; /** * @returns true if the tween is still playing after the update, false @@ -170,7 +140,7 @@ declare class Sequence { static nextId(): number; } -declare const VERSION = "18.6.4"; +declare const VERSION = "19.0.0"; declare const nextId: typeof Sequence.nextId; declare const getAll: () => Tween>[]; @@ -179,61 +149,22 @@ declare const add: (tween: Tween>) => void; declare const remove: (tween: Tween>) => void; declare const update: (time?: number, preserve?: boolean) => boolean; declare const exports: { - Easing: { - Linear: { - None: (amount: number) => number; - }; - Quadratic: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Cubic: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Quartic: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Quintic: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Sinusoidal: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Exponential: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Circular: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Elastic: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Back: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - Bounce: { - In: (amount: number) => number; - Out: (amount: number) => number; - InOut: (amount: number) => number; - }; - }; + Easing: Readonly<{ + Linear: Readonly; + Quadratic: Readonly; + Cubic: Readonly; + Quartic: Readonly; + Quintic: Readonly; + Sinusoidal: Readonly; + Exponential: Readonly; + Circular: Readonly; + Elastic: Readonly; + Back: Readonly; + Bounce: Readonly; + generatePow(power?: number): EasingFunctionGroup; + }>; Group: typeof Group; Interpolation: { Linear: (v: number[], k: number) => number; diff --git a/dist/tween.esm.js b/dist/tween.esm.js index 610a1cdb..31c416c8 100644 --- a/dist/tween.esm.js +++ b/dist/tween.esm.js @@ -1,13 +1,22 @@ /** * The Ease class provides a collection of easing functions for use with tween.js. */ -var Easing = { - Linear: { +var Easing = Object.freeze({ + Linear: Object.freeze({ None: function (amount) { return amount; }, - }, - Quadratic: { + In: function (amount) { + return this.None(amount); + }, + Out: function (amount) { + return this.None(amount); + }, + InOut: function (amount) { + return this.None(amount); + }, + }), + Quadratic: Object.freeze({ In: function (amount) { return amount * amount; }, @@ -20,8 +29,8 @@ var Easing = { } return -0.5 * (--amount * (amount - 2) - 1); }, - }, - Cubic: { + }), + Cubic: Object.freeze({ In: function (amount) { return amount * amount * amount; }, @@ -34,8 +43,8 @@ var Easing = { } return 0.5 * ((amount -= 2) * amount * amount + 2); }, - }, - Quartic: { + }), + Quartic: Object.freeze({ In: function (amount) { return amount * amount * amount * amount; }, @@ -48,8 +57,8 @@ var Easing = { } return -0.5 * ((amount -= 2) * amount * amount * amount - 2); }, - }, - Quintic: { + }), + Quintic: Object.freeze({ In: function (amount) { return amount * amount * amount * amount * amount; }, @@ -62,19 +71,19 @@ var Easing = { } return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2); }, - }, - Sinusoidal: { + }), + Sinusoidal: Object.freeze({ In: function (amount) { - return 1 - Math.cos((amount * Math.PI) / 2); + return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2); }, Out: function (amount) { return Math.sin((amount * Math.PI) / 2); }, InOut: function (amount) { - return 0.5 * (1 - Math.cos(Math.PI * amount)); + return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount))); }, - }, - Exponential: { + }), + Exponential: Object.freeze({ In: function (amount) { return amount === 0 ? 0 : Math.pow(1024, amount - 1); }, @@ -93,8 +102,8 @@ var Easing = { } return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2); }, - }, - Circular: { + }), + Circular: Object.freeze({ In: function (amount) { return 1 - Math.sqrt(1 - amount * amount); }, @@ -107,8 +116,8 @@ var Easing = { } return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1); }, - }, - Elastic: { + }), + Elastic: Object.freeze({ In: function (amount) { if (amount === 0) { return 0; @@ -140,15 +149,15 @@ var Easing = { } return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1; }, - }, - Back: { + }), + Back: Object.freeze({ In: function (amount) { var s = 1.70158; - return amount * amount * ((s + 1) * amount - s); + return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s); }, Out: function (amount) { var s = 1.70158; - return --amount * amount * ((s + 1) * amount + s) + 1; + return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1; }, InOut: function (amount) { var s = 1.70158 * 1.525; @@ -157,8 +166,8 @@ var Easing = { } return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2); }, - }, - Bounce: { + }), + Bounce: Object.freeze({ In: function (amount) { return 1 - Easing.Bounce.Out(1 - amount); }, @@ -182,8 +191,27 @@ var Easing = { } return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5; }, + }), + generatePow: function (power) { + if (power === void 0) { power = 4; } + power = power < Number.EPSILON ? Number.EPSILON : power; + power = power > 10000 ? 10000 : power; + return { + In: function (amount) { + return Math.pow(amount, power); + }, + Out: function (amount) { + return 1 - Math.pow((1 - amount), power); + }, + InOut: function (amount) { + if (amount < 0.5) { + return Math.pow((amount * 2), power) / 2; + } + return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5; + }, + }; }, -}; +}); var now; // Include a performance.now polyfill. @@ -396,8 +424,10 @@ var Tween = /** @class */ (function () { this._startTime = 0; this._easingFunction = Easing.Linear.None; this._interpolationFunction = Interpolation.Linear; + // eslint-disable-next-line this._chainedTweens = []; this._onStartCallbackFired = false; + this._onEveryStartCallbackFired = false; this._id = Sequence.nextId(); this._isChainStopped = false; this._goToEnd = false; @@ -423,10 +453,13 @@ var Tween = /** @class */ (function () { return this; }; Tween.prototype.duration = function (d) { + if (d === void 0) { d = 1000; } this._duration = d; return this; }; - Tween.prototype.start = function (time) { + Tween.prototype.start = function (time, overrideStartingValues) { + if (time === void 0) { time = now$1(); } + if (overrideStartingValues === void 0) { overrideStartingValues = false; } if (this._isPlaying) { return this; } @@ -445,13 +478,17 @@ var Tween = /** @class */ (function () { this._isPlaying = true; this._isPaused = false; this._onStartCallbackFired = false; + this._onEveryStartCallbackFired = false; this._isChainStopped = false; - this._startTime = time !== undefined ? (typeof time === 'string' ? now$1() + parseFloat(time) : time) : now$1(); + this._startTime = time; this._startTime += this._delayTime; - this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat); + this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues); return this; }; - Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) { + Tween.prototype.startFromCurrentValues = function (time) { + return this.start(time, true); + }; + Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) { for (var property in _valuesEnd) { var startValue = _object[property]; var startValueIsArray = Array.isArray(startValue); @@ -471,7 +508,9 @@ var Tween = /** @class */ (function () { // handle an array of relative values endValues = endValues.map(this._handleRelativeValue.bind(this, startValue)); // Create a local copy of the Array with the start value at the front - _valuesEnd[property] = [startValue].concat(endValues); + if (_valuesStart[property] === undefined) { + _valuesEnd[property] = [startValue].concat(endValues); + } } // handle the deepness of the values if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) { @@ -485,11 +524,11 @@ var Tween = /** @class */ (function () { _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values? // eslint-disable-next-line // @ts-ignore FIXME? - this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]); + this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues); } else { - // Save the starting value, but only once. - if (typeof _valuesStart[property] === 'undefined') { + // Save the starting value, but only once unless override is requested. + if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) { _valuesStart[property] = startValue; } if (!startValueIsArray) { @@ -560,14 +599,17 @@ var Tween = /** @class */ (function () { return this; }; Tween.prototype.group = function (group) { + if (group === void 0) { group = mainGroup; } this._group = group; return this; }; Tween.prototype.delay = function (amount) { + if (amount === void 0) { amount = 0; } this._delayTime = amount; return this; }; Tween.prototype.repeat = function (times) { + if (times === void 0) { times = 0; } this._initialRepeat = times; this._repeat = times; return this; @@ -577,17 +619,21 @@ var Tween = /** @class */ (function () { return this; }; Tween.prototype.yoyo = function (yoyo) { + if (yoyo === void 0) { yoyo = false; } this._yoyo = yoyo; return this; }; Tween.prototype.easing = function (easingFunction) { + if (easingFunction === void 0) { easingFunction = Easing.Linear.None; } this._easingFunction = easingFunction; return this; }; Tween.prototype.interpolation = function (interpolationFunction) { + if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; } this._interpolationFunction = interpolationFunction; return this; }; + // eslint-disable-next-line Tween.prototype.chain = function () { var tweens = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -600,6 +646,10 @@ var Tween = /** @class */ (function () { this._onStartCallback = callback; return this; }; + Tween.prototype.onEveryStart = function (callback) { + this._onEveryStartCallback = callback; + return this; + }; Tween.prototype.onUpdate = function (callback) { this._onUpdateCallback = callback; return this; @@ -633,7 +683,7 @@ var Tween = /** @class */ (function () { if (time > endTime) return false; if (autoStart) - this.start(time); + this.start(time, true); } this._goToEnd = false; if (time < this._startTime) { @@ -645,6 +695,12 @@ var Tween = /** @class */ (function () { } this._onStartCallbackFired = true; } + if (this._onEveryStartCallbackFired === false) { + if (this._onEveryStartCallback) { + this._onEveryStartCallback(this._object); + } + this._onEveryStartCallbackFired = true; + } elapsed = (time - this._startTime) / this._duration; elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed; var value = this._easingFunction(elapsed); @@ -683,6 +739,7 @@ var Tween = /** @class */ (function () { if (this._onRepeatCallback) { this._onRepeatCallback(this._object); } + this._onEveryStartCallbackFired = false; return true; } else { @@ -692,7 +749,7 @@ var Tween = /** @class */ (function () { for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) { // Make the chained tweens start exactly at the time they should, // even if the `update()` method was called way past the duration of the tween - this._chainedTweens[i].start(this._startTime + this._duration); + this._chainedTweens[i].start(this._startTime + this._duration, false); } this._isPlaying = false; return false; @@ -756,7 +813,7 @@ var Tween = /** @class */ (function () { return Tween; }()); -var VERSION = '18.6.4'; +var VERSION = '19.0.0'; /** * Tween.js - Licensed under the MIT license diff --git a/dist/tween.umd.js b/dist/tween.umd.js index 0d2f36eb..a75c60dc 100644 --- a/dist/tween.umd.js +++ b/dist/tween.umd.js @@ -7,13 +7,22 @@ /** * The Ease class provides a collection of easing functions for use with tween.js. */ - var Easing = { - Linear: { + var Easing = Object.freeze({ + Linear: Object.freeze({ None: function (amount) { return amount; }, - }, - Quadratic: { + In: function (amount) { + return this.None(amount); + }, + Out: function (amount) { + return this.None(amount); + }, + InOut: function (amount) { + return this.None(amount); + }, + }), + Quadratic: Object.freeze({ In: function (amount) { return amount * amount; }, @@ -26,8 +35,8 @@ } return -0.5 * (--amount * (amount - 2) - 1); }, - }, - Cubic: { + }), + Cubic: Object.freeze({ In: function (amount) { return amount * amount * amount; }, @@ -40,8 +49,8 @@ } return 0.5 * ((amount -= 2) * amount * amount + 2); }, - }, - Quartic: { + }), + Quartic: Object.freeze({ In: function (amount) { return amount * amount * amount * amount; }, @@ -54,8 +63,8 @@ } return -0.5 * ((amount -= 2) * amount * amount * amount - 2); }, - }, - Quintic: { + }), + Quintic: Object.freeze({ In: function (amount) { return amount * amount * amount * amount * amount; }, @@ -68,19 +77,19 @@ } return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2); }, - }, - Sinusoidal: { + }), + Sinusoidal: Object.freeze({ In: function (amount) { - return 1 - Math.cos((amount * Math.PI) / 2); + return 1 - Math.sin(((1.0 - amount) * Math.PI) / 2); }, Out: function (amount) { return Math.sin((amount * Math.PI) / 2); }, InOut: function (amount) { - return 0.5 * (1 - Math.cos(Math.PI * amount)); + return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount))); }, - }, - Exponential: { + }), + Exponential: Object.freeze({ In: function (amount) { return amount === 0 ? 0 : Math.pow(1024, amount - 1); }, @@ -99,8 +108,8 @@ } return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2); }, - }, - Circular: { + }), + Circular: Object.freeze({ In: function (amount) { return 1 - Math.sqrt(1 - amount * amount); }, @@ -113,8 +122,8 @@ } return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1); }, - }, - Elastic: { + }), + Elastic: Object.freeze({ In: function (amount) { if (amount === 0) { return 0; @@ -146,15 +155,15 @@ } return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1; }, - }, - Back: { + }), + Back: Object.freeze({ In: function (amount) { var s = 1.70158; - return amount * amount * ((s + 1) * amount - s); + return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s); }, Out: function (amount) { var s = 1.70158; - return --amount * amount * ((s + 1) * amount + s) + 1; + return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1; }, InOut: function (amount) { var s = 1.70158 * 1.525; @@ -163,8 +172,8 @@ } return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2); }, - }, - Bounce: { + }), + Bounce: Object.freeze({ In: function (amount) { return 1 - Easing.Bounce.Out(1 - amount); }, @@ -188,8 +197,27 @@ } return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5; }, + }), + generatePow: function (power) { + if (power === void 0) { power = 4; } + power = power < Number.EPSILON ? Number.EPSILON : power; + power = power > 10000 ? 10000 : power; + return { + In: function (amount) { + return Math.pow(amount, power); + }, + Out: function (amount) { + return 1 - Math.pow((1 - amount), power); + }, + InOut: function (amount) { + if (amount < 0.5) { + return Math.pow((amount * 2), power) / 2; + } + return (1 - Math.pow((2 - amount * 2), power)) / 2 + 0.5; + }, + }; }, - }; + }); var now; // Include a performance.now polyfill. @@ -402,8 +430,10 @@ this._startTime = 0; this._easingFunction = Easing.Linear.None; this._interpolationFunction = Interpolation.Linear; + // eslint-disable-next-line this._chainedTweens = []; this._onStartCallbackFired = false; + this._onEveryStartCallbackFired = false; this._id = Sequence.nextId(); this._isChainStopped = false; this._goToEnd = false; @@ -429,10 +459,13 @@ return this; }; Tween.prototype.duration = function (d) { + if (d === void 0) { d = 1000; } this._duration = d; return this; }; - Tween.prototype.start = function (time) { + Tween.prototype.start = function (time, overrideStartingValues) { + if (time === void 0) { time = now$1(); } + if (overrideStartingValues === void 0) { overrideStartingValues = false; } if (this._isPlaying) { return this; } @@ -451,13 +484,17 @@ this._isPlaying = true; this._isPaused = false; this._onStartCallbackFired = false; + this._onEveryStartCallbackFired = false; this._isChainStopped = false; - this._startTime = time !== undefined ? (typeof time === 'string' ? now$1() + parseFloat(time) : time) : now$1(); + this._startTime = time; this._startTime += this._delayTime; - this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat); + this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues); return this; }; - Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat) { + Tween.prototype.startFromCurrentValues = function (time) { + return this.start(time, true); + }; + Tween.prototype._setupProperties = function (_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) { for (var property in _valuesEnd) { var startValue = _object[property]; var startValueIsArray = Array.isArray(startValue); @@ -477,7 +514,9 @@ // handle an array of relative values endValues = endValues.map(this._handleRelativeValue.bind(this, startValue)); // Create a local copy of the Array with the start value at the front - _valuesEnd[property] = [startValue].concat(endValues); + if (_valuesStart[property] === undefined) { + _valuesEnd[property] = [startValue].concat(endValues); + } } // handle the deepness of the values if ((propType === 'object' || startValueIsArray) && startValue && !isInterpolationList) { @@ -491,11 +530,11 @@ _valuesStartRepeat[property] = startValueIsArray ? [] : {}; // TODO? repeat nested values? And yoyo? And array values? // eslint-disable-next-line // @ts-ignore FIXME? - this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property]); + this._setupProperties(startValue, _valuesStart[property], _valuesEnd[property], _valuesStartRepeat[property], overrideStartingValues); } else { - // Save the starting value, but only once. - if (typeof _valuesStart[property] === 'undefined') { + // Save the starting value, but only once unless override is requested. + if (typeof _valuesStart[property] === 'undefined' || overrideStartingValues) { _valuesStart[property] = startValue; } if (!startValueIsArray) { @@ -566,14 +605,17 @@ return this; }; Tween.prototype.group = function (group) { + if (group === void 0) { group = mainGroup; } this._group = group; return this; }; Tween.prototype.delay = function (amount) { + if (amount === void 0) { amount = 0; } this._delayTime = amount; return this; }; Tween.prototype.repeat = function (times) { + if (times === void 0) { times = 0; } this._initialRepeat = times; this._repeat = times; return this; @@ -583,17 +625,21 @@ return this; }; Tween.prototype.yoyo = function (yoyo) { + if (yoyo === void 0) { yoyo = false; } this._yoyo = yoyo; return this; }; Tween.prototype.easing = function (easingFunction) { + if (easingFunction === void 0) { easingFunction = Easing.Linear.None; } this._easingFunction = easingFunction; return this; }; Tween.prototype.interpolation = function (interpolationFunction) { + if (interpolationFunction === void 0) { interpolationFunction = Interpolation.Linear; } this._interpolationFunction = interpolationFunction; return this; }; + // eslint-disable-next-line Tween.prototype.chain = function () { var tweens = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -606,6 +652,10 @@ this._onStartCallback = callback; return this; }; + Tween.prototype.onEveryStart = function (callback) { + this._onEveryStartCallback = callback; + return this; + }; Tween.prototype.onUpdate = function (callback) { this._onUpdateCallback = callback; return this; @@ -639,7 +689,7 @@ if (time > endTime) return false; if (autoStart) - this.start(time); + this.start(time, true); } this._goToEnd = false; if (time < this._startTime) { @@ -651,6 +701,12 @@ } this._onStartCallbackFired = true; } + if (this._onEveryStartCallbackFired === false) { + if (this._onEveryStartCallback) { + this._onEveryStartCallback(this._object); + } + this._onEveryStartCallbackFired = true; + } elapsed = (time - this._startTime) / this._duration; elapsed = this._duration === 0 || elapsed > 1 ? 1 : elapsed; var value = this._easingFunction(elapsed); @@ -689,6 +745,7 @@ if (this._onRepeatCallback) { this._onRepeatCallback(this._object); } + this._onEveryStartCallbackFired = false; return true; } else { @@ -698,7 +755,7 @@ for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) { // Make the chained tweens start exactly at the time they should, // even if the `update()` method was called way past the duration of the tween - this._chainedTweens[i].start(this._startTime + this._duration); + this._chainedTweens[i].start(this._startTime + this._duration, false); } this._isPlaying = false; return false; @@ -762,7 +819,7 @@ return Tween; }()); - var VERSION = '18.6.4'; + var VERSION = '19.0.0'; /** * Tween.js - Licensed under the MIT license diff --git a/package-lock.json b/package-lock.json index 307f7c8e..d18dcee7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tweenjs/tween.js", - "version": "18.6.4", + "version": "19.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@tweenjs/tween.js", - "version": "18.6.4", + "version": "19.0.0", "license": "MIT", "devDependencies": { "@sinonjs/fake-timers": "^6.0.1", diff --git a/package.json b/package.json index 6122470c..1297939c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@tweenjs/tween.js", "description": "Super simple, fast and easy to use tweening engine which incorporates optimised Robert Penner's equations.", - "version": "18.6.4", + "version": "19.0.0", "main": "dist/tween.cjs.js", "types": "dist/tween.d.ts", "module": "dist/tween.esm.js", diff --git a/src/Version.ts b/src/Version.ts index 09758d00..bf02c788 100644 --- a/src/Version.ts +++ b/src/Version.ts @@ -1,2 +1,2 @@ -const VERSION = '18.6.4' +const VERSION = '19.0.0' export default VERSION