Animation
Per-clip animation state on nodes (node.animations[name]), events, and options for play/blend.
AnimationState
Section titled “AnimationState”Per-clip state from node.animations[name]. .events is a Map (event name → AnimationEvent); use events["Event_Name"] = AnimationEvent.new(), then dispatch via pendingEvents and call events[event.name].invoke(event.name, event.time).
Constructor
Section titled “Constructor”AnimationState.new() (typically obtained from node.animations[name]).
Time & params
Section titled “Time & params”| Method / property | Description |
|---|---|
name | Clip name |
length | Duration in seconds |
currentTimeSeconds / currentTimeNormalized | Playback position |
getFloat(key) / setFloat(key, value) | Float param (short key or path with .) |
getInt(key) / setInt(key, value) | Int param |
getBool(key) / setBool(key, value) | Bool param |
Playback
Section titled “Playback”| Method | Description |
|---|---|
play(playOptions) | Start playing (optional AnimationPlayOptions) |
pause() | Pause |
resume() | Resume |
events | Map of event name → AnimationEvent |
pendingEvents | Events to dispatch this frame |
AnimationEvent
Section titled “AnimationEvent”Named event (e.g. onStart, onEnd, or Blender marker). Create with AnimationEvent.new(), assign to animState.events["Event_Name"], then addCallback(fn(event) {}). invoke(name, time) is called when dispatching from pendingEvents.
name / time
Section titled “name / time”Event name and time.
addCallback(callback) / removeCallback(callback)
Section titled “addCallback(callback) / removeCallback(callback)”Add or remove a callback. Callback receives the event.
invoke(name, time)
Section titled “invoke(name, time)”Called when dispatching; invokes registered callbacks.
AnimationPlayOptions
Section titled “AnimationPlayOptions”Options for starting a clip (e.g. reverse, time offset, speed).
Constructor
Section titled “Constructor”AnimationPlayOptions.new()
reverse / reverse=(value)
Section titled “reverse / reverse=(value)”Whether to play in reverse.
AnimationBlendOptions
Section titled “AnimationBlendOptions”Options for blending between clips. Reserved for future use.
Constructor
Section titled “Constructor”AnimationBlendOptions.new()