Phaser API Documentation

  Version: 
addMix(animA, animB, delay)

Description:

Adds a mix between two animations.

Mixing allows you to specify a unique delay between a pairing of animations.

When playing Animation A on a Game Object, if you then play Animation B, and a mix exists, it will wait for the specified delay to be over before playing Animation B.

This allows you to customise smoothing between different types of animation, such as blending between an idle and a walk state, or a running and a firing state.

Note that mixing is only applied if you use the Sprite.play method. If you opt to use playAfterRepeat or playAfterDelay instead, those will take priority and the mix delay will not be used.

To update an existing mix, just call this method with the new delay.

To remove a mix pairing, see the removeMix method.

Parameters:

name type description
animA string | Phaser.Animations.Animation

The string-based key, or instance of, Animation A.

animB string | Phaser.Animations.Animation

The string-based key, or instance of, Animation B.

delay number

The delay, in milliseconds, to wait when transitioning from Animation A to B.

Returns:
Description:

This Animation Manager.

Since: 3.50.0