Phaser API Documentation

  Version: 
staggerPlay(key, children, stagger, [staggerFirst])

Description:

Takes an array of Game Objects that have an Animation Component and then starts the given animation playing on them. The start time of each Game Object is offset, incrementally, by the stagger amount.

For example, if you pass an array with 4 children and a stagger time of 1000, the delays will be:

child 1: 1000ms delay child 2: 2000ms delay child 3: 3000ms delay child 4: 4000ms delay

If you set the staggerFirst parameter to false they would be:

child 1: 0ms delay child 2: 1000ms delay child 3: 2000ms delay child 4: 3000ms delay

You can also set stagger to be a negative value. If it was -1000, the above would be:

child 1: 3000ms delay child 2: 2000ms delay child 3: 1000ms delay child 4: 0ms delay

Parameters:

name type arguments Default description
key string | Phaser.Animations.Animation | Phaser.Types.Animations.PlayAnimationConfig

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

children Phaser.GameObjects.GameObject | Array.<Phaser.GameObjects.GameObject>

An array of Game Objects to play the animation on. They must have an Animation Component.

stagger number

The amount of time, in milliseconds, to offset each play time by. If a negative value is given, it's applied to the children in reverse order.

staggerFirst boolean <optional> true

Should the first child be staggered as well?

Returns:
Description:

This Animation Manager.

Since: 3.0.0