mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
Calling Tween.play
on a tween that had already finished and was pending removal will stop the tween from getting stuck in an isPlaying
state and will restart the tween again from the beginning. Calling play
on a Tween that is already playing does nothing. Fix #4184
This commit is contained in:
parent
0012ed3524
commit
2d3c905f53
2 changed files with 15 additions and 5 deletions
|
@ -129,7 +129,8 @@ Notes:
|
|||
* Calling `Tween.restart` multiple times in a row would cause the tween to freeze. It will now disregard all additional calls to `restart` if it's already in a pending state (thanks @rgk)
|
||||
* Tween Timelines would only apply the `delay` value of a child tween once and not on loop. Fix #3841 (thanks @Edwin222 @Antriel)
|
||||
* `Texture.add` will no longer let you add a frame to a texture with the same name or index as one that already exists in the texture. Doing so will now return `null` instead of a Frame object, and the `frameTotal` will never be incremented. Fix #4459 (thanks @BigZaphod)
|
||||
* The InputPlugin will now dispatch an update event regardless, allowing the Gamepad Plugin to update itself every frame, regardless of DOM events. This allows Gamepads to work correctly again. Fix #4414 (thanks @CipSoft-Components)
|
||||
* The InputPlugin will now dispatch an update event regardless, allowing the Gamepad Plugin to update itself every frame, regardless of OM events. This allows Gamepads to work correctly again. Fix #4414 (thanks @CipSoft-Components)
|
||||
* Calling `Tween.play` on a tween that had already finished and was pending removal will stop the tween from getting stuck in an `isPlaying` state and will restart the tween again from the beginning. Calling `play` on a Tween that is already playing does nothing. Fix #4184 (thanks @SamCode)
|
||||
|
||||
|
||||
### Examples, Documentation and TypeScript
|
||||
|
|
|
@ -635,25 +635,34 @@ var Tween = new Class({
|
|||
* Starts a Tween playing.
|
||||
*
|
||||
* You only need to call this method if you have configured the tween to be paused on creation.
|
||||
*
|
||||
* If the Tween is already playing, calling this method again will have no effect. If you wish to
|
||||
* restart the Tween, use `Tween.restart` instead.
|
||||
*
|
||||
* Calling this method after the Tween has completed will start the Tween playing again from the start.
|
||||
* This is the same as calling `Tween.seek(0)` and then `Tween.play()`.
|
||||
*
|
||||
* @method Phaser.Tweens.Tween#play
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {boolean} resetFromTimeline - Is this Tween being played as part of a Timeline?
|
||||
* @param {boolean} [resetFromTimeline=false] - Is this Tween being played as part of a Timeline?
|
||||
*
|
||||
* @return {this} This Tween instance.
|
||||
*/
|
||||
play: function (resetFromTimeline)
|
||||
{
|
||||
if (this.state === TWEEN_CONST.ACTIVE)
|
||||
if (resetFromTimeline === undefined) { resetFromTimeline = false; }
|
||||
|
||||
if (this.state === TWEEN_CONST.ACTIVE || this.state === TWEEN_CONST.PENDING_ADD)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
else if (this.state === TWEEN_CONST.PENDING_REMOVE || this.state === TWEEN_CONST.REMOVED)
|
||||
{
|
||||
this.init();
|
||||
this.seek(0);
|
||||
this.parent.makeActive(this);
|
||||
resetFromTimeline = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
var onStart = this.callbacks.onStart;
|
||||
|
|
Loading…
Reference in a new issue