Skip to content

Commit 1bcdc87

Browse files
committed
BaseTweenData.duration can now never be zero or less than zero, which would trigger NaN errors. It's now clamped to a minimum of 0.01ms. Fix #6955
1 parent c8219a3 commit 1bcdc87

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tweens/tween/BaseTweenData.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ var BaseTweenData = new Class({
6666

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

7778
/**
7879
* The total calculated duration, in milliseconds, of this TweenData.

0 commit comments

Comments
 (0)