Skip to content

Animation

Per-clip animation state on nodes (node.animations[name]), events, and options for play/blend.

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).

AnimationState.new() (typically obtained from node.animations[name]).

Method / propertyDescription
nameClip name
lengthDuration in seconds
currentTimeSeconds / currentTimeNormalizedPlayback 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
MethodDescription
play(playOptions)Start playing (optional AnimationPlayOptions)
pause()Pause
resume()Resume
eventsMap of event name → AnimationEvent
pendingEventsEvents to dispatch this frame

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.

Event name and time.

addCallback(callback) / removeCallback(callback)

Section titled “addCallback(callback) / removeCallback(callback)”

Add or remove a callback. Callback receives the event.

Called when dispatching; invokes registered callbacks.


Options for starting a clip (e.g. reverse, time offset, speed).

AnimationPlayOptions.new()

Whether to play in reverse.


Options for blending between clips. Reserved for future use.

AnimationBlendOptions.new()