animation component
Plays animation clips on the node. library is the clip asset, autoplay the clip started on load, speed_scale the rate; the animation module drives…
Nesta página
animation · 4 properties · Animation
Plays animation clips on the node. library is the clip asset, autoplay the clip started on load, speed_scale the rate; the animation module drives playback.
In a scene, animation is the node key that applies it. A script reaches each property below as a field on node.animation: reading one asks the running component, and assigning one leaves the rest alone. The whole table is node.animation.get() and node.animation.set(table).
Properties
| property | type | default | description |
|---|---|---|---|
autoplay |
string | — | Clip to start when the scene loads; empty starts nothing |
library |
asset · animation_library |
— | The clip library this node plays from |
root_node |
node | — | The node the clip's tracks resolve against; empty means this node |
speed_scale |
float | 1 |
Playback rate for every clip on this node |
Asset types this component references: animation_library.
Script functions
Methods of node.animation, the handle a node carrying this component exposes. Every handle also has get(), set(table), patch(table), has() and remove().
From animation:
| method | what it does |
|---|---|
add_clip(string, any) |
Give this node a clip of its own under that name, from a definition table shaped like a scene file's. |
current_clip() -> string? |
The clip playing or paused on this node, and nil once it has ended, been stopped, or never started. |
is_playing() -> bool |
Whether a clip is advancing on this node; a paused, stopped, finished or absent one answers false. |
just_finished() -> string? |
The clip that ended on this node during the last step, and nil on every other frame. |
pause() |
Hold the playhead where it is, keeping the clip current so resume has something to go back to. |
play(string, any?) |
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(string) |
Play the clip of that name once the current one ends; a looping clip never ends, so a queue behind one never drains. |
resume() |
Carry on from where pause left off; a stopped, finished or never-started node is left alone. |
seek(float) |
Move the playhead to a number of seconds and pose the node there, even on a paused or ended clip. |
time() -> float |
Seconds of playback since the current clip started, before wrapping; a stopped clip keeps where it stopped. |