@tweenjs/tween.js
Advanced tools
Comparing version 18.6.2 to 18.6.3
@@ -251,2 +251,4 @@ define(['exports'], function (exports) { 'use strict'; | ||
Group.prototype.update = function (time, preserve) { | ||
if (time === void 0) { time = now$1(); } | ||
if (preserve === void 0) { preserve = false; } | ||
var tweenIds = Object.keys(this._tweens); | ||
@@ -256,3 +258,2 @@ if (tweenIds.length === 0) { | ||
} | ||
time = time !== undefined ? time : now$1(); | ||
// Tweens are updated in "batches". If you add a new tween during an | ||
@@ -267,3 +268,4 @@ // update, then the new tween will be updated in the next batch. | ||
var tween = this._tweens[tweenIds[i]]; | ||
if (tween && tween.update(time, preserve) === false && !preserve) { | ||
var autoStart = !preserve; | ||
if (tween && tween.update(time, autoStart) === false && !preserve) { | ||
delete this._tweens[tweenIds[i]]; | ||
@@ -418,5 +420,7 @@ } | ||
Tween.prototype.to = function (properties, duration) { | ||
for (var prop in properties) { | ||
this._valuesEnd[prop] = properties[prop]; | ||
} | ||
// TODO? restore this, then update the 07_dynamic_to example to set fox | ||
// tween's to on each update. That way the behavior is opt-in (there's | ||
// currently no opt-out). | ||
// for (const prop in properties) this._valuesEnd[prop] = properties[prop] | ||
this._valuesEnd = Object.create(properties); | ||
if (duration !== undefined) { | ||
@@ -436,4 +440,3 @@ this._duration = duration; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.add(this); | ||
this._group && this._group.add(this); | ||
this._repeat = this._initialRepeat; | ||
@@ -524,4 +527,3 @@ if (this._reversed) { | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.remove(this); | ||
this._group && this._group.remove(this); | ||
this._isPlaying = false; | ||
@@ -540,2 +542,3 @@ this._isPaused = false; | ||
Tween.prototype.pause = function (time) { | ||
if (time === void 0) { time = now$1(); } | ||
if (this._isPaused || !this._isPlaying) { | ||
@@ -545,9 +548,9 @@ return this; | ||
this._isPaused = true; | ||
this._pauseStart = time === undefined ? now$1() : time; | ||
this._pauseStart = time; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.remove(this); | ||
this._group && this._group.remove(this); | ||
return this; | ||
}; | ||
Tween.prototype.resume = function (time) { | ||
if (time === void 0) { time = now$1(); } | ||
if (!this._isPaused || !this._isPlaying) { | ||
@@ -557,7 +560,6 @@ return this; | ||
this._isPaused = false; | ||
this._startTime += (time === undefined ? now$1() : time) - this._pauseStart; | ||
this._startTime += time - this._pauseStart; | ||
this._pauseStart = 0; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.add(this); | ||
this._group && this._group.add(this); | ||
return this; | ||
@@ -628,5 +630,12 @@ }; | ||
}; | ||
Tween.prototype.update = function (time, preserve) { | ||
/** | ||
* @returns true if the tween is still playing after the update, false | ||
* otherwise (calling update on a paused tween still returns true because | ||
* it is still playing, just paused). | ||
*/ | ||
Tween.prototype.update = function (time, autoStart) { | ||
if (time === void 0) { time = now$1(); } | ||
if (preserve === void 0) { preserve = false; } | ||
if (autoStart === void 0) { autoStart = true; } | ||
if (this._isPaused) | ||
return true; | ||
var property; | ||
@@ -638,3 +647,3 @@ var elapsed; | ||
return false; | ||
if (!preserve) | ||
if (autoStart) | ||
this.start(time); | ||
@@ -764,3 +773,3 @@ } | ||
var VERSION = '18.6.2'; | ||
var VERSION = '18.6.3'; | ||
@@ -767,0 +776,0 @@ /** |
@@ -253,2 +253,4 @@ 'use strict'; | ||
Group.prototype.update = function (time, preserve) { | ||
if (time === void 0) { time = now$1(); } | ||
if (preserve === void 0) { preserve = false; } | ||
var tweenIds = Object.keys(this._tweens); | ||
@@ -258,3 +260,2 @@ if (tweenIds.length === 0) { | ||
} | ||
time = time !== undefined ? time : now$1(); | ||
// Tweens are updated in "batches". If you add a new tween during an | ||
@@ -269,3 +270,4 @@ // update, then the new tween will be updated in the next batch. | ||
var tween = this._tweens[tweenIds[i]]; | ||
if (tween && tween.update(time, preserve) === false && !preserve) { | ||
var autoStart = !preserve; | ||
if (tween && tween.update(time, autoStart) === false && !preserve) { | ||
delete this._tweens[tweenIds[i]]; | ||
@@ -420,5 +422,7 @@ } | ||
Tween.prototype.to = function (properties, duration) { | ||
for (var prop in properties) { | ||
this._valuesEnd[prop] = properties[prop]; | ||
} | ||
// TODO? restore this, then update the 07_dynamic_to example to set fox | ||
// tween's to on each update. That way the behavior is opt-in (there's | ||
// currently no opt-out). | ||
// for (const prop in properties) this._valuesEnd[prop] = properties[prop] | ||
this._valuesEnd = Object.create(properties); | ||
if (duration !== undefined) { | ||
@@ -438,4 +442,3 @@ this._duration = duration; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.add(this); | ||
this._group && this._group.add(this); | ||
this._repeat = this._initialRepeat; | ||
@@ -526,4 +529,3 @@ if (this._reversed) { | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.remove(this); | ||
this._group && this._group.remove(this); | ||
this._isPlaying = false; | ||
@@ -542,2 +544,3 @@ this._isPaused = false; | ||
Tween.prototype.pause = function (time) { | ||
if (time === void 0) { time = now$1(); } | ||
if (this._isPaused || !this._isPlaying) { | ||
@@ -547,9 +550,9 @@ return this; | ||
this._isPaused = true; | ||
this._pauseStart = time === undefined ? now$1() : time; | ||
this._pauseStart = time; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.remove(this); | ||
this._group && this._group.remove(this); | ||
return this; | ||
}; | ||
Tween.prototype.resume = function (time) { | ||
if (time === void 0) { time = now$1(); } | ||
if (!this._isPaused || !this._isPlaying) { | ||
@@ -559,7 +562,6 @@ return this; | ||
this._isPaused = false; | ||
this._startTime += (time === undefined ? now$1() : time) - this._pauseStart; | ||
this._startTime += time - this._pauseStart; | ||
this._pauseStart = 0; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.add(this); | ||
this._group && this._group.add(this); | ||
return this; | ||
@@ -630,5 +632,12 @@ }; | ||
}; | ||
Tween.prototype.update = function (time, preserve) { | ||
/** | ||
* @returns true if the tween is still playing after the update, false | ||
* otherwise (calling update on a paused tween still returns true because | ||
* it is still playing, just paused). | ||
*/ | ||
Tween.prototype.update = function (time, autoStart) { | ||
if (time === void 0) { time = now$1(); } | ||
if (preserve === void 0) { preserve = false; } | ||
if (autoStart === void 0) { autoStart = true; } | ||
if (this._isPaused) | ||
return true; | ||
var property; | ||
@@ -640,3 +649,3 @@ var elapsed; | ||
return false; | ||
if (!preserve) | ||
if (autoStart) | ||
this.start(time); | ||
@@ -766,3 +775,3 @@ } | ||
var VERSION = '18.6.2'; | ||
var VERSION = '18.6.3'; | ||
@@ -769,0 +778,0 @@ /** |
@@ -108,3 +108,3 @@ declare type EasingFunction = (amount: number) => number; | ||
private _isChainStopped; | ||
constructor(_object: T, _group?: Group); | ||
constructor(_object: T, _group?: Group | false); | ||
getId(): number; | ||
@@ -119,4 +119,4 @@ isPlaying(): boolean; | ||
end(): this; | ||
pause(time: number): this; | ||
resume(time: number): this; | ||
pause(time?: number): this; | ||
resume(time?: number): this; | ||
stopChainedTweens(): this; | ||
@@ -137,3 +137,8 @@ group(group: Group): this; | ||
private _goToEnd; | ||
update(time?: number, preserve?: boolean): boolean; | ||
/** | ||
* @returns true if the tween is still playing after the update, false | ||
* otherwise (calling update on a paused tween still returns true because | ||
* it is still playing, just paused). | ||
*/ | ||
update(time?: number, autoStart?: boolean): boolean; | ||
private _updateProperties; | ||
@@ -158,3 +163,3 @@ private _handleRelativeValue; | ||
remove(tween: Tween<UnknownProps>): void; | ||
update(time: number, preserve?: boolean): boolean; | ||
update(time?: number, preserve?: boolean): boolean; | ||
} | ||
@@ -172,3 +177,3 @@ | ||
declare const VERSION = "18.6.2"; | ||
declare const VERSION = "18.6.3"; | ||
@@ -180,3 +185,3 @@ declare const nextId: typeof Sequence.nextId; | ||
declare const remove: (tween: Tween<Record<string, unknown>>) => void; | ||
declare const update: (time: number, preserve?: boolean | undefined) => boolean; | ||
declare const update: (time?: number, preserve?: boolean) => boolean; | ||
declare const exports: { | ||
@@ -259,3 +264,3 @@ Easing: { | ||
remove: (tween: Tween<Record<string, unknown>>) => void; | ||
update: (time: number, preserve?: boolean | undefined) => boolean; | ||
update: (time?: number, preserve?: boolean) => boolean; | ||
}; | ||
@@ -262,0 +267,0 @@ |
@@ -249,2 +249,4 @@ /** | ||
Group.prototype.update = function (time, preserve) { | ||
if (time === void 0) { time = now$1(); } | ||
if (preserve === void 0) { preserve = false; } | ||
var tweenIds = Object.keys(this._tweens); | ||
@@ -254,3 +256,2 @@ if (tweenIds.length === 0) { | ||
} | ||
time = time !== undefined ? time : now$1(); | ||
// Tweens are updated in "batches". If you add a new tween during an | ||
@@ -265,3 +266,4 @@ // update, then the new tween will be updated in the next batch. | ||
var tween = this._tweens[tweenIds[i]]; | ||
if (tween && tween.update(time, preserve) === false && !preserve) { | ||
var autoStart = !preserve; | ||
if (tween && tween.update(time, autoStart) === false && !preserve) { | ||
delete this._tweens[tweenIds[i]]; | ||
@@ -416,5 +418,7 @@ } | ||
Tween.prototype.to = function (properties, duration) { | ||
for (var prop in properties) { | ||
this._valuesEnd[prop] = properties[prop]; | ||
} | ||
// TODO? restore this, then update the 07_dynamic_to example to set fox | ||
// tween's to on each update. That way the behavior is opt-in (there's | ||
// currently no opt-out). | ||
// for (const prop in properties) this._valuesEnd[prop] = properties[prop] | ||
this._valuesEnd = Object.create(properties); | ||
if (duration !== undefined) { | ||
@@ -434,4 +438,3 @@ this._duration = duration; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.add(this); | ||
this._group && this._group.add(this); | ||
this._repeat = this._initialRepeat; | ||
@@ -522,4 +525,3 @@ if (this._reversed) { | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.remove(this); | ||
this._group && this._group.remove(this); | ||
this._isPlaying = false; | ||
@@ -538,2 +540,3 @@ this._isPaused = false; | ||
Tween.prototype.pause = function (time) { | ||
if (time === void 0) { time = now$1(); } | ||
if (this._isPaused || !this._isPlaying) { | ||
@@ -543,9 +546,9 @@ return this; | ||
this._isPaused = true; | ||
this._pauseStart = time === undefined ? now$1() : time; | ||
this._pauseStart = time; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.remove(this); | ||
this._group && this._group.remove(this); | ||
return this; | ||
}; | ||
Tween.prototype.resume = function (time) { | ||
if (time === void 0) { time = now$1(); } | ||
if (!this._isPaused || !this._isPlaying) { | ||
@@ -555,7 +558,6 @@ return this; | ||
this._isPaused = false; | ||
this._startTime += (time === undefined ? now$1() : time) - this._pauseStart; | ||
this._startTime += time - this._pauseStart; | ||
this._pauseStart = 0; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.add(this); | ||
this._group && this._group.add(this); | ||
return this; | ||
@@ -626,5 +628,12 @@ }; | ||
}; | ||
Tween.prototype.update = function (time, preserve) { | ||
/** | ||
* @returns true if the tween is still playing after the update, false | ||
* otherwise (calling update on a paused tween still returns true because | ||
* it is still playing, just paused). | ||
*/ | ||
Tween.prototype.update = function (time, autoStart) { | ||
if (time === void 0) { time = now$1(); } | ||
if (preserve === void 0) { preserve = false; } | ||
if (autoStart === void 0) { autoStart = true; } | ||
if (this._isPaused) | ||
return true; | ||
var property; | ||
@@ -636,3 +645,3 @@ var elapsed; | ||
return false; | ||
if (!preserve) | ||
if (autoStart) | ||
this.start(time); | ||
@@ -762,3 +771,3 @@ } | ||
var VERSION = '18.6.2'; | ||
var VERSION = '18.6.3'; | ||
@@ -765,0 +774,0 @@ /** |
@@ -255,2 +255,4 @@ (function (global, factory) { | ||
Group.prototype.update = function (time, preserve) { | ||
if (time === void 0) { time = now$1(); } | ||
if (preserve === void 0) { preserve = false; } | ||
var tweenIds = Object.keys(this._tweens); | ||
@@ -260,3 +262,2 @@ if (tweenIds.length === 0) { | ||
} | ||
time = time !== undefined ? time : now$1(); | ||
// Tweens are updated in "batches". If you add a new tween during an | ||
@@ -271,3 +272,4 @@ // update, then the new tween will be updated in the next batch. | ||
var tween = this._tweens[tweenIds[i]]; | ||
if (tween && tween.update(time, preserve) === false && !preserve) { | ||
var autoStart = !preserve; | ||
if (tween && tween.update(time, autoStart) === false && !preserve) { | ||
delete this._tweens[tweenIds[i]]; | ||
@@ -422,5 +424,7 @@ } | ||
Tween.prototype.to = function (properties, duration) { | ||
for (var prop in properties) { | ||
this._valuesEnd[prop] = properties[prop]; | ||
} | ||
// TODO? restore this, then update the 07_dynamic_to example to set fox | ||
// tween's to on each update. That way the behavior is opt-in (there's | ||
// currently no opt-out). | ||
// for (const prop in properties) this._valuesEnd[prop] = properties[prop] | ||
this._valuesEnd = Object.create(properties); | ||
if (duration !== undefined) { | ||
@@ -440,4 +444,3 @@ this._duration = duration; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.add(this); | ||
this._group && this._group.add(this); | ||
this._repeat = this._initialRepeat; | ||
@@ -528,4 +531,3 @@ if (this._reversed) { | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.remove(this); | ||
this._group && this._group.remove(this); | ||
this._isPlaying = false; | ||
@@ -544,2 +546,3 @@ this._isPaused = false; | ||
Tween.prototype.pause = function (time) { | ||
if (time === void 0) { time = now$1(); } | ||
if (this._isPaused || !this._isPlaying) { | ||
@@ -549,9 +552,9 @@ return this; | ||
this._isPaused = true; | ||
this._pauseStart = time === undefined ? now$1() : time; | ||
this._pauseStart = time; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.remove(this); | ||
this._group && this._group.remove(this); | ||
return this; | ||
}; | ||
Tween.prototype.resume = function (time) { | ||
if (time === void 0) { time = now$1(); } | ||
if (!this._isPaused || !this._isPlaying) { | ||
@@ -561,7 +564,6 @@ return this; | ||
this._isPaused = false; | ||
this._startTime += (time === undefined ? now$1() : time) - this._pauseStart; | ||
this._startTime += time - this._pauseStart; | ||
this._pauseStart = 0; | ||
// eslint-disable-next-line | ||
// @ts-ignore FIXME? | ||
this._group.add(this); | ||
this._group && this._group.add(this); | ||
return this; | ||
@@ -632,5 +634,12 @@ }; | ||
}; | ||
Tween.prototype.update = function (time, preserve) { | ||
/** | ||
* @returns true if the tween is still playing after the update, false | ||
* otherwise (calling update on a paused tween still returns true because | ||
* it is still playing, just paused). | ||
*/ | ||
Tween.prototype.update = function (time, autoStart) { | ||
if (time === void 0) { time = now$1(); } | ||
if (preserve === void 0) { preserve = false; } | ||
if (autoStart === void 0) { autoStart = true; } | ||
if (this._isPaused) | ||
return true; | ||
var property; | ||
@@ -642,3 +651,3 @@ var elapsed; | ||
return false; | ||
if (!preserve) | ||
if (autoStart) | ||
this.start(time); | ||
@@ -768,3 +777,3 @@ } | ||
var VERSION = '18.6.2'; | ||
var VERSION = '18.6.3'; | ||
@@ -771,0 +780,0 @@ /** |
{ | ||
"name": "@tweenjs/tween.js", | ||
"description": "Super simple, fast and easy to use tweening engine which incorporates optimised Robert Penner's equations.", | ||
"version": "18.6.2", | ||
"version": "18.6.3", | ||
"main": "dist/tween.cjs.js", | ||
@@ -6,0 +6,0 @@ "types": "dist/tween.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142612
3482