Phaser API Documentation

  Version: 
chain(key)

Description:

Sets an animation, or an array of animations, to be played in the future, after the current one completes or stops.

The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, or have one of the stop methods called.

An animation set to repeat forever will never enter a completed state unless stopped.

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 event).

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.

Call this method with no arguments to reset all currently chained animations.

Parameters:

name type description
key string | Array.<string> | Phaser.Animations.Animation | Array.<Phaser.Animations.Animation> | Phaser.Types.Animations.PlayAnimationConfig | Array.<Phaser.Types.Animations.PlayAnimationConfig>

The string-based key of the animation to play, or an Animation instance, or a PlayAnimationConfig object, or an array of them.

Returns:
Description:

The Game Object that owns this Animation Component.

Since: 3.16.0