Skip to content

Commit e04504f

Browse files
committed
Tweens with 'yoyo' set on them couldn't be re-used again because the start and end properties were left in a reversed state. When a yoyo tween ends it now restores the reversed values (thanks @SBCGames phaserjs#2307)
1 parent 1883cfc commit e04504f

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
292292
* SoundManager.destroy now calls AudioContext.close (thanks @stoneman1 #2237)
293293
* Sound.onEndedHandler now sets Sound.currentTime to be Sound.durationMS (thanks @stoneman1 #2237)
294294
* BitmapData would always create a private `_swapCanvas` which was a clone of its main canvas used for advanced movement operations. This no longer happens. The swap canvas is created only as needed, by those functions that use it (specifically `moveH` and `moveV`), meaning a BitmapData will now use half the amount of memory it used to, and you'll have half the amount of canvas DOM elements created (unless you make heavy use of the move functions).
295+
* Tweens with 'yoyo' set on them couldn't be re-used again because the start and end properties were left in a reversed state. When a yoyo tween ends it now restores the reversed values (thanks @SBCGames #2307)
295296

296297
### Bug Fixes
297298

src/tween/TweenData.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,15 @@ Phaser.TweenData.prototype = {
494494
// We're already in reverse mode, which means the yoyo has finished and there's no repeats, so end
495495
if (this.inReverse && this.repeatCounter === 0)
496496
{
497+
// Restore the properties
498+
for (var property in this.vStartCache)
499+
{
500+
this.vStart[property] = this.vStartCache[property];
501+
this.vEnd[property] = this.vEndCache[property];
502+
}
503+
504+
this.inReverse = false;
505+
497506
return Phaser.TweenData.COMPLETE;
498507
}
499508

0 commit comments

Comments
 (0)