JavaScript animation engine
`reset(softReset)` `softReset` parameter type is now a `Boolean` instead of an int
Julian Garniera19ce548f644
diff --git a/package.json b/package.jsonindex 9ef164d5..d8ec1047 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "animejs",- "version": "4.2.0",+ "version": "4.2.1","homepage": "https://animejs.com","description": "JavaScript animation engine","author": "Julian Garnier <[email protected]>",diff --git a/src/animatable/animatable.js b/src/animatable/animatable.jsindex b632b133..9b570572 100644--- a/src/animatable/animatable.js+++ b/src/animatable/animatable.js@@ -133,7 +133,7 @@ export class Animatable {tween._currentTime = 0;});if (!isUnd(duration)) animation.stretch(duration);- animation.reset(1).resume();+ animation.reset(true).resume();return this;}};diff --git a/src/timeline/timeline.js b/src/timeline/timeline.jsindex 4bd1fc34..f4c3a6f4 100644--- a/src/timeline/timeline.js+++ b/src/timeline/timeline.js@@ -118,7 +118,7 @@ function addTlChild(childParams, tl, timePosition, targets, index, length) {const tlChild = targets ?new JSAnimation(targets,/** @type {AnimationParams} */(childParams), tl, adjustedPosition, false, index, length) :new Timer(/** @type {TimerParams} */(childParams), tl, adjustedPosition);- tlChild.init(1);+ tlChild.init(true);// TODO: Might be better to insert at a position relative to startTime?addChild(tl, tlChild);forEachChildren(tl, (/** @type {Renderable} */child) => {@@ -222,7 +222,7 @@ export class Timeline extends Timer {parseTimelinePosition(this,a2),);}- return this.init(1); // 1 = internalRender+ return this.init(true);}}diff --git a/src/timer/timer.js b/src/timer/timer.jsindex a4e9757c..af51fa7a 100644--- a/src/timer/timer.js+++ b/src/timer/timer.js@@ -144,7 +144,6 @@ export class Timer extends Clock {/** @type {Number} */(timerLoop) < 0 ? Infinity :/** @type {Number} */(timerLoop) + 1;-let offsetPosition = 0;if (parent) {@@ -234,7 +233,7 @@ export class Timer extends Clock {}set cancelled(cancelled) {- cancelled ? this.cancel() : this.reset(1).play();+ cancelled ? this.cancel() : this.reset(true).play();}get currentTime() {@@ -299,10 +298,10 @@ export class Timer extends Clock {}/**- * @param {Number} internalRender+ * @param {Boolean} [softReset]* @return {this}*/- reset(internalRender = 0) {+ reset(softReset = false) {// If cancelled, revive the timer before rendering in order to have propertly composed tweens siblingsreviveTimer(this);if (this._reversed && !this._reverse) this.reversed = false;@@ -311,7 +310,7 @@ export class Timer extends Clock {// NOTE: This is only required for Timelines and might be better to move to the Timeline class?this._iterationTime = this.iterationDuration;// Set tickMode to tickModes.FORCE to force rendering- tick(this, 0, 1, internalRender, tickModes.FORCE);+ tick(this, 0, 1, ~~softReset, tickModes.FORCE);// Reset timer properties after revive / render to make sure the props are not updated againresetTimerProperties(this);// Also reset children properties@@ -322,16 +321,16 @@ export class Timer extends Clock {}/**- * @param {Number} internalRender+ * @param {Boolean} internalRender* @return {this}*/- init(internalRender = 0) {+ init(internalRender = false) {this.fps = this._fps;this.speed = this._speed;// Manually calling .init() on timelines should render all children intial state// Forces all children to render once then render to 0 when resetedif (!internalRender && this._hasChildren) {- tick(this, this.duration, 1, internalRender, tickModes.FORCE);+ tick(this, this.duration, 1, ~~internalRender, tickModes.FORCE);}this.reset(internalRender);// Make sure to set autoplay to false to child timers so it doesn't attempt to autoplay / link@@ -385,7 +384,7 @@ export class Timer extends Clock {/** @return {this} */restart() {- return this.reset(0).resume();+ return this.reset().resume();}/**