Skip to content

Commit

Permalink
BaseTweenData.duration can now never be zero or less than zero, whi…
Browse files Browse the repository at this point in the history
…ch would trigger NaN errors. It's now clamped to a minimum of 0.01ms. Fix #6955
  • Loading branch information
photonstorm committed Jan 2, 2025
1 parent c8219a3 commit 1bcdc87
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tweens/tween/BaseTweenData.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ var BaseTweenData = new Class({

/**
* The duration of the tween in milliseconds, excluding any time required
* for yoyo or repeats.
* for yoyo or repeats. A tween can never have a duration of zero, so this
* will be set to 0.01 if the value is incorrectly less than or equal to zero.
*
* @name Phaser.Tweens.BaseTweenData#duration
* @type {number}
* @since 3.60.0
*/
this.duration = duration;
this.duration = (duration <= 0) ? 0.01 : duration;

/**
* The total calculated duration, in milliseconds, of this TweenData.
Expand Down

0 comments on commit 1bcdc87

Please sign in to comment.