Skip to main content

Class: AnimationController

Defined in: animations/types/AnimationController.ts:15

Class to manage animation transitions based on animation conditions and inputs

Constructors

Constructor

new AnimationController(...animationTransitions): AnimationController

Defined in: animations/types/AnimationController.ts:33

Creates a new instance of AnimationController.

Parameters

animationTransitions

...AnimationTransition[]

an array of animation transitions to initialize the controller with

Returns

AnimationController

Properties

animationTransitions

animationTransitions: AnimationTransition[]

Defined in: animations/types/AnimationController.ts:19

A list of animation transitions used to find the next animation

Methods

findNextAnimation()

findNextAnimation(entity, currentAnimation, inputs, endOfAnimation): null | Animation

Defined in: animations/types/AnimationController.ts:46

Finds the next animation to play based on the transitions. Returns null if the animation is not changing. If no transition is triggered at the end of an animation, returns the current animation

Parameters

entity

Entity

the entity this controller is acting on

currentAnimation

Animation

the current animation

inputs

AnimationInputs

the animation inputs

endOfAnimation

boolean

whether we are at the end of the current animation

Returns

null | Animation

the next animation, or null if the animation is not changing


getEntryAnimation()

getEntryAnimation(inputs): Animation

Defined in: animations/types/AnimationController.ts:75

Gets the entry animation for the given inputs.

Parameters

inputs

AnimationInputs

the animation inputs

Returns

Animation

the animation to play on entry, based on the 'entry' state