You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -145,6 +145,7 @@ one set of bindings ever created, which makes things a lot cleaner.
145
145
* The Animation class now emits the `start` event when played (either forward, or in reverse) by any Game Object.
146
146
* The Animation class now emits the `restart` event when it restarts playing on any Game Object.
147
147
* The Animation class now emits the `complete` event when it finishes playing on any Game Object.
148
+
* The Animation Component has a new method called `chain` which allows you to line-up another animation to start playing as soon as the current one stops, no matter how it stops (either by reaching its natural end, or directly by having stop called on it). You can chain a new animation at any point, including before the current one starts playing, during it, or when it ends (via its `animationcomplete` callback). Chained animations are specific to a Game Object, meaning different Game Objects can have different chained animations without impacting the global animation they're playing.
* @param {(string|Phaser.Animations.Animation)} [key] - The string-based key of the animation to play next, as defined previously in the Animation Manager. Or an Animation instance.
389
+
*
390
+
* @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component.
391
+
*/
392
+
chain: function(key)
393
+
{
394
+
if(keyinstanceofBaseAnimation)
395
+
{
396
+
key=key.key;
397
+
}
398
+
399
+
this.nextAnim=key;
400
+
401
+
returnthis.parent;
402
+
},
403
+
366
404
/**
367
405
* Sets the amount of time, in milliseconds, that the animation will be delayed before starting playback.
368
406
*
@@ -842,6 +880,8 @@ var Animation = new Class({
842
880
843
881
/**
844
882
* Immediately stops the current animation from playing and dispatches the `animationcomplete` event.
883
+
*
884
+
* If there is another animation queued (via the `chain` method) then it will start playing immediately.
0 commit comments