Merge pull request #6802 from samme/feature/timeline-timeScale

Add Phaser.Time.Timeline#timeScale
This commit is contained in:
Zeke Chan 2024-07-16 15:56:34 +08:00 committed by GitHub
commit 71684df68e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -133,6 +133,22 @@ var Timeline = new Class({
*/
this.elapsed = 0;
/**
* The Timeline's delta time scale.
*
* Values higher than 1 increase the speed of time, while values smaller than 1 decrease it.
* A value of 0 freezes time and is effectively equivalent to pausing the Timeline.
*
* This doesn't affect the delta time scale of any Tweens created by the Timeline.
* You will have to set the `timeScale` of each Tween or the Tween Manager if you want them to match.
*
* @name Phaser.Time.Timeline#timeScale
* @type {number}
* @default
* @since 3.90.0
*/
this.timeScale = 1;
/**
* Whether the Timeline is running (`true`) or active (`false`).
*
@ -241,7 +257,7 @@ var Timeline = new Class({
return;
}
this.elapsed += delta;
this.elapsed += delta * this.timeScale;
},
/**