animation
Clip playback on a node's animation component: play, pause, seek and query. tween builds a short clip from a table of steps and returns a handle.
Clip playback on a node's animation component: play, pause, seek and query. tween builds a short clip from a table of steps and returns a handle.
19 functions, 79 constants. Scripts reach it as animation::.
Acts on animation, state_machine: those functions are also methods on the component's handle, without the node argument.
Functions
Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.
| function | acts on | what it does |
|---|---|---|
add_clip(Node, string, animation::Clip) |
animation |
Give this node a clip of its own under that name, shaped like a scene file's. |
current_clip(Node) -> str? |
animation |
The clip playing or paused on this node, and nil once it has ended, been stopped, or never started. |
current_state(Node) -> str? |
state_machine |
The state the machine is in, or nil before it has entered one. |
ease(string, float) -> float |
— | The named curve at t, from 0 to 1: what a tween's ease does to its progress, for a number a script moves itself. |
ease_names() -> [str] |
— | Every curve an ease takes, by name: the bare linear, then eleven transitions in four modes each. |
is_playing(Node) -> bool |
animation |
Whether a clip is advancing on this node; a paused, stopped, finished or absent one answers false. |
is_tween_running(int) -> bool |
— | Whether a handle still names a running tween; one that finished, was stopped, or lost its node answers false. Takes a tween handle, where is_playing takes a node and asks about its clip. |
jump(Node, string) |
state_machine |
Cut the state machine to the named state on the next step, with no fade. |
pause(Node) |
animation |
Hold the playhead where it is, keeping the clip current so resume has something to go back to. |
play(Node, string, animation::PlayOptions?) |
animation |
Start the clip of that name on this node; the trailing options table takes speed_scale (a multiplier), from_start, blend_time (seconds to blend out of the clip before), ease (the blend's curve, an EASE_* constant), and retarget (a bone_map reference, so this rig can play another rig's clips). |
queue(Node, string) |
animation |
Play the clip of that name once the current one ends; a looping clip never ends, so a queue behind one never drains. |
resume(Node) |
animation |
Carry on from where pause left off; a stopped, finished or never-started node is left alone. |
seek(Node, float) |
animation |
Move the playhead to a number of seconds and pose the node there, even on a paused or ended clip. |
set_condition(Node, string, bool) |
state_machine |
Turn on or off a condition that auto transitions wait on. |
stop(Node) |
animation |
End the clip on this node, leaving the pose where it is; resume cannot revive it. |
stop_tween(int) |
— | End the tween a handle names, leaving the pose where it is. |
time(Node) -> float |
animation |
Seconds of playback since the current clip started, before wrapping; a stopped clip keeps where it stopped. |
travel(Node, string) |
state_machine |
Head for the named state through the cheapest chain of transitions, each costing its priority and fading as it says; a state no transition reaches is cut to directly. |
tween(Node, animation::Tween) -> int |
— | Generate a clip on the node from a table of steps and run it, returning the handle stop_tween and is_tween_running take. The table also takes delay in seconds, then = <handle> to wait for another tween, loops and speed_scale; a step's call names a method; the node's on_tween_finished(handle) is called when it runs out. |
Constants
| name | value |
|---|---|
ADVANCE_MODE_AUTO |
"auto" |
ADVANCE_MODE_DISABLED |
"disabled" |
ADVANCE_MODE_ENABLED |
"enabled" |
EASE_IN_BACK |
"in_back" |
EASE_IN_BOUNCE |
"in_bounce" |
EASE_IN_CIRC |
"in_circ" |
EASE_IN_CUBIC |
"in_cubic" |
EASE_IN_ELASTIC |
"in_elastic" |
EASE_IN_EXPO |
"in_expo" |
EASE_IN_OUT_BACK |
"in_out_back" |
EASE_IN_OUT_BOUNCE |
"in_out_bounce" |
EASE_IN_OUT_CIRC |
"in_out_circ" |
EASE_IN_OUT_CUBIC |
"in_out_cubic" |
EASE_IN_OUT_ELASTIC |
"in_out_elastic" |
EASE_IN_OUT_EXPO |
"in_out_expo" |
EASE_IN_OUT_QUAD |
"in_out_quad" |
EASE_IN_OUT_QUART |
"in_out_quart" |
EASE_IN_OUT_QUINT |
"in_out_quint" |
EASE_IN_OUT_SINE |
"in_out_sine" |
EASE_IN_OUT_SPRING |
"in_out_spring" |
EASE_IN_QUAD |
"in_quad" |
EASE_IN_QUART |
"in_quart" |
EASE_IN_QUINT |
"in_quint" |
EASE_IN_SINE |
"in_sine" |
EASE_IN_SPRING |
"in_spring" |
EASE_LINEAR |
"linear" |
EASE_OUT_BACK |
"out_back" |
EASE_OUT_BOUNCE |
"out_bounce" |
EASE_OUT_CIRC |
"out_circ" |
EASE_OUT_CUBIC |
"out_cubic" |
EASE_OUT_ELASTIC |
"out_elastic" |
EASE_OUT_EXPO |
"out_expo" |
EASE_OUT_IN_BACK |
"out_in_back" |
EASE_OUT_IN_BOUNCE |
"out_in_bounce" |
EASE_OUT_IN_CIRC |
"out_in_circ" |
EASE_OUT_IN_CUBIC |
"out_in_cubic" |
EASE_OUT_IN_ELASTIC |
"out_in_elastic" |
EASE_OUT_IN_EXPO |
"out_in_expo" |
EASE_OUT_IN_QUAD |
"out_in_quad" |
EASE_OUT_IN_QUART |
"out_in_quart" |
EASE_OUT_IN_QUINT |
"out_in_quint" |
EASE_OUT_IN_SINE |
"out_in_sine" |
EASE_OUT_IN_SPRING |
"out_in_spring" |
EASE_OUT_QUAD |
"out_quad" |
EASE_OUT_QUART |
"out_quart" |
EASE_OUT_QUINT |
"out_quint" |
EASE_OUT_SINE |
"out_sine" |
EASE_OUT_SPRING |
"out_spring" |
EVENT_ANIMATION_CHANGED |
"animation_changed" |
EVENT_ANIMATION_FINISHED |
"animation_finished" |
EVENT_ANIMATION_LOOPED |
"animation_looped" |
EVENT_ANIMATION_STARTED |
"animation_started" |
EVENT_STATE_ENTERED |
"state_entered" |
EVENT_STATE_EXITED |
"state_exited" |
EVENT_TWEEN_FINISHED |
"tween_finished" |
EVENT_TWEEN_LOOPED |
"tween_looped" |
EVENT_TWEEN_STEP |
"tween_step" |
INTERPOLATION_CUBIC |
"cubic" |
INTERPOLATION_LINEAR |
"linear" |
INTERPOLATION_STEP |
"step" |
LOOP_LINEAR |
"linear" |
LOOP_NONE |
"none" |
LOOP_PINGPONG |
"pingpong" |
MODIFIER_CCDIK |
"ccdik" |
MODIFIER_FABRIK |
"fabrik" |
MODIFIER_JIGGLE |
"jiggle" |
MODIFIER_LOOK_AT |
"look_at" |
MODIFIER_TWO_BONE_IK |
"two_bone_ik" |
PROPERTY_DEFORM |
"polygon/deform" |
PROPERTY_POSITION |
"position" |
PROPERTY_ROTATION |
"rotation" |
PROPERTY_ROTATION_EULER |
"rotation_euler" |
PROPERTY_SCALE |
"scale" |
PROPERTY_TINT |
"tint" |
PROPERTY_VISIBLE |
"visible" |
STATE_END |
"end" |
SWITCH_MODE_AT_END |
"at_end" |
SWITCH_MODE_IMMEDIATE |
"immediate" |
SWITCH_MODE_SYNC |
"sync" |