Tween.complete will allow you to flag a tween as being complete, no matter what stage it is at. If an onComplete callback has been defined it will be invoked. You can set an optional delay before this happens (thanks @Jerenaux for the idea)

Fix #3280
This commit is contained in:
Richard Davey 2018-02-28 21:14:56 +00:00
parent 14399d6910
commit a89be7abc5
2 changed files with 46 additions and 1 deletions

View file

@ -6,12 +6,17 @@
* Game.resize allows you to resize the game config, renderer and input system in one call. * Game.resize allows you to resize the game config, renderer and input system in one call.
* InputManager.resize allows you to update the bounds def and input scale in one call. * InputManager.resize allows you to update the bounds def and input scale in one call.
* Game.Config.roundPixels property added to prevent sub-pixel interpolation during rendering of Game Objects. * Game.Config.roundPixels property added to prevent sub-pixel interpolation during rendering of Game Objects in WebGL and Canvas.
* Load.plugin now accepts a class as an argument as well as a URL string (thanks @nkholski)
* Tween.complete will allow you to flag a tween as being complete, no matter what stage it is at. If an onComplete callback has been defined it will be invoked. You can set an optional delay before this happens (thanks @Jerenaux for the idea)
### Bug Fixes ### Bug Fixes
* Arcade Physics Bodies didn't apply the results of `allowRotation` to the parent Game Object. * Arcade Physics Bodies didn't apply the results of `allowRotation` to the parent Game Object.
* InputManager.updateBounds wouldn't correctly get the bounds of the canvas if it had horizontal or vertical translation in the page, causing the scale factor to be off (and subsequently input values to mis-fire) * InputManager.updateBounds wouldn't correctly get the bounds of the canvas if it had horizontal or vertical translation in the page, causing the scale factor to be off (and subsequently input values to mis-fire)
* TileSprite.setFrame now works and allows you to change the frame to any other in the texture. Fix #3232 (thanks @Jerenaux)
* Swapped the queue loop in the SceneManager to to use `_queue.length` rather than a cached length (thanks @srobertson421)
* When calling `ScenePlugin.launch` the `data` argument is now passed to the queued scenes (thanks @gaudeon)
### Updates ### Updates
@ -20,6 +25,9 @@
* BitmapText.setText will check if the value given is falsey but not a zero and set to an empty string if so. * BitmapText.setText will check if the value given is falsey but not a zero and set to an empty string if so.
* BitmapText.setText will now cast the given value to a string before setting. * BitmapText.setText will now cast the given value to a string before setting.
* BitmapText.setText will not change the text via `setText` unless the new text is different to the old one. * BitmapText.setText will not change the text via `setText` unless the new text is different to the old one.
* If you set `transparent` in the Game Config but didn't provide a `backgroundColor` then it would render as black. It will now be properly transparent. If you do provide a color value then it must include an alpha component.
* You can now pass normal Groups to Arcade Physics collide / overlap, as well as Physics Groups. Fix #3277 (thanks @nkholski)
* Documentation updates: thanks to @melissaelopez @samme
## Version 3.1.2 - 23rd February 2018 ## Version 3.1.2 - 23rd February 2018

View file

@ -824,6 +824,43 @@ var Tween = new Class({
return this; return this;
}, },
/**
* Flags the Tween as being complete, whatever stage of progress it is at.
*
* If an onComplete callback has been defined it will automatically invoke it, unless a `delay`
* argument is provided, in which case the Tween will delay for that period of time before calling the callback.
*
* If you don't need a delay, or have an onComplete callback, then call `Tween.stop` instead.
*
* @method Phaser.Tweens.Tween#complete
* @since 3.2.0
*
* @param {number} [delay=0] - The time to wait before invoking the complete callback. If zero it will fire immediately.
*/
complete: function (delay)
{
if (delay === undefined) { delay = 0; }
if (delay)
{
this.countdown = delay;
this.state = TWEEN_CONST.COMPLETE_DELAY;
}
else
{
var onComplete = this.callbacks.onComplete;
if (onComplete)
{
onComplete.params[1] = this.targets;
onComplete.func.apply(onComplete.scope, onComplete.params);
}
this.state = TWEEN_CONST.PENDING_REMOVE;
}
},
/** /**
* Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager.
* *