Skip to content

@orillusion/core


Class: StateMachine

Defined in: src/components/anim/graph/StateMachine.ts:65

Lightweight, data-driven animation state machine.

Plug into an AnimatorComponent via animator.setStateMachine(fsm). On every onUpdate the FSM advances time, evaluates transitions, and may issue a crossFade on the underlying animator.

Why no visual graph editor: shipping a graph UX is a multi-year investment. A JSON/TS DSL covers 90% of use cases at <5% the cost; DCC tooling (Blender / Maya) is the right home for authoring.

Constructors

Constructor

new StateMachine(states, initial?, params?): StateMachine

Defined in: src/components/anim/graph/StateMachine.ts:72

Parameters

states

StateDef[]

initial?

string

params?

AnimatorParams

Returns

StateMachine

Accessors

params

Get Signature

get params(): AnimatorParams

Defined in: src/components/anim/graph/StateMachine.ts:82

Returns

AnimatorParams


currentState

Get Signature

get currentState(): StateDef

Defined in: src/components/anim/graph/StateMachine.ts:83

Returns

StateDef


currentStateName

Get Signature

get currentStateName(): string

Defined in: src/components/anim/graph/StateMachine.ts:84

Returns

string

Methods

sync()

sync(animator): void

Defined in: src/components/anim/graph/StateMachine.ts:91

Convenience: ensure the underlying animator is playing the right clip. Should be called once after attaching the FSM, or any time external code wants to force a sync.

Parameters

animator

AnimatorComponent

Returns

void


evaluate()

evaluate(animator, dt): void

Defined in: src/components/anim/graph/StateMachine.ts:96

Called by AnimatorComponent.onUpdate every frame.

Parameters

animator

AnimatorComponent

dt

number

Returns

void