AnimationTransition

Properties

from

:

string

get set

The name of the start animation

to

:

string

get set

The name of the transition animation

trigger

:

AnimationTriggerCallback

get set

The function that determines the transition to the next animation

flipX

:

AnimationTriggerCallback

get set

The function that determines the need for an x-axis flip

flipY

:

AnimationTriggerCallback

get set

The function that determines the need for an y-axis flip


An Example:
In the code below show how to add a Transition to an Animator in the method create in the Hero class

class Hero extends Sprite { 
  ...

  async create () {
    ...
    animator.addTransition({
      from: 'idle',
      to: 'dead',
      trigger: () => this.health <= 0,
      flipX: () => this.isFlipped
    })
  }
}