Animation · class
AnimationStateMachine
Explained in Animation.
class AnimationStateMachineimport { AnimationStateMachine } from '@driftengine/animation';Constructor
new
constructor(states: readonly AnimationState[], transitions: readonly AnimationTransition[], jointCount: number, bind?: Pose)| Parameter | Type | Description |
|---|---|---|
states | readonly AnimationState[] | |
transitions | readonly AnimationTransition[] | |
jointCount | number | |
bind? | Pose | The bind pose, or omitted for one whose channels start at rest.
The same reason BlendTree takes one: a crossfade calls blendPoses, which interpolates
every channel, so without a bind pose the two sides of a fade start at zero translation and
the figure folds toward its own origin for the length of the transition. |
Accessors
| Name | Type | Description |
|---|---|---|
currentget | string | |
transitioningget | boolean | Whether a crossfade is running. A caller wanting to gate input on one asks this. |
Methods
set
set(parameter: string, value: number): voidSet a parameter the transitions read.
| Parameter | Type | Description |
|---|---|---|
parameter | string | |
value | number |
More
Unlike BlendTree.set this accepts any name: the predicates are the consumer's own functions
and this class cannot know which keys they read. The tree below it still refuses a name no node
declares, which is where a typo that matters is caught.
advance
advance(dtSec: number): voidAdvance by a caller-supplied step: the fade, the active state's clock, and any transition whose condition now holds.
| Parameter | Type | Description |
|---|---|---|
dtSec | number |
evaluate
evaluate(out: Pose): voidThe current pose, crossfaded if a transition is running. Allocates nothing.
| Parameter | Type | Description |
|---|---|---|
out | Pose |