Skip to content

Search

Documentation

animation module

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.

En esta página

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.

20 functions, 80 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, any) animation Give this node a clip of its own under that name, from a definition table shaped like a scene file's.
current_clip(node) -> string? animation The clip playing or paused on this node, and nil once it has ended, been stopped, or never started.
current_state(node) -> any state_machine The state the machine is in, or nil before it has entered one.
ease_names() -> any — 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(any) -> 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.
just_finished(node) -> string? animation The clip that ended on this node during the last step, and nil on every other frame.
pause(node) animation Hold the playhead where it is, keeping the clip current so resume has something to go back to.
play(node, string, any?) 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(any) — End the clip on a node, or the tween a handle names, leaving the pose where it is; resume cannot revive it.
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, any) -> int — Generate a clip on the node from a table of steps and run it, returning the handle stop 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 or passes a function; the node's on_tween_finished(handle) is called when it runs out.
tween_value(any, any, float, string?) -> int — A tween over a number, or a list of up to four, that drives no node: read it each frame with tween_value_of and write it wherever you like. Returns a handle stop takes.
tween_value_of(any) -> any — Where a value tween has got to, in the shape it was started with; nil once it is over.

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_FINISHED state_finished
EVENT_STATE_STARTED state_started
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_FOLLOW follow
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