Animation Player
Keyframe animation sequencer supporting property tracks, transitions, and timeline scrubbing.
Type: AnimationPlayerNode · Category: Animation & Effects · Also found as: animationplayer
Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
reverse |
boolean | false |
Play the animation backwards. |
autoplay |
boolean | false |
Start playing the current animation when the node becomes ready. |
Plus the common properties every node has.
Lua methods
Section titled “Lua methods”Call them on the node (self.node in its script, or self.node:get_node("path")). Every node also has the Node methods.
AnimationPlayerNode:connect(event, handler)
Section titled “AnimationPlayerNode:connect(event, handler)”Connects a handler to one of this node’s events: animation_finished (A non-looping animation ended (Aseprite: a tag’s repeats are done)), animation_event (A Method key of the animation fired (its method name)); the tree events; custom ones.
self.node:connect("animation_finished", function(value, source) Log.info("animation_finished") end)eventAnimationPlayerNodeEvent|stringhandlerfun(value:any, source: AnimationPlayerNode)
Returns integer id Connection id for disconnect
AnimationPlayerNode:get_property(path)
Section titled “AnimationPlayerNode:get_property(path)”Reads an Inspector property by its path (vectors and colours as tables); “script.
local value = self.node:get_property("reverse")pathAnimationPlayerNodeProperty|string
Returns any
AnimationPlayerNode:set_property(path, value, y)
Section titled “AnimationPlayerNode:set_property(path, value, y)”Sets an Inspector property by its path: vectors as {x, y} or x, y; colours as {r, g, b[, a]} 0..1 or “#rrggbb[aa]”; enums by name; “script.
self.node:set_property("reverse", true)pathAnimationPlayerNodeProperty|stringvalueanyy?number
AnimationPlayerNode:animation_play(name, blend)
Section titled “AnimationPlayerNode:animation_play(name, blend)”Plays an animation, optionally switching to the specified animation name first.
With blend > 0 the previous pose crossfades into the new animation over that many seconds.
Event tracks fire while playing: method tracks call self:<method>(frame) on the
track’s target node script; sound tracks play their audio file on the key’s frame.
self.node:get_node("AnimationPlayer"):animation_play("run", 0.15)name?AnimationName|stringAnimation name (the project’s complete)blend?numberCrossfade time in seconds (default 0)
AnimationPlayerNode:animation_stop()
Section titled “AnimationPlayerNode:animation_stop()”Stops animation playback and freezes at current frame.
self.node:get_node("AnimationPlayer"):animation_stop()AnimationPlayerNode:animation_pause()
Section titled “AnimationPlayerNode:animation_pause()”Pauses animation playback.
self.node:get_node("AnimationPlayer"):animation_pause()AnimationPlayerNode:animation_resume()
Section titled “AnimationPlayerNode:animation_resume()”Resumes animation playback from the current frame.
self.node:get_node("AnimationPlayer"):animation_resume()AnimationPlayerNode:animation_reset()
Section titled “AnimationPlayerNode:animation_reset()”Resets the animation to the first frame.
self.node:get_node("AnimationPlayer"):animation_reset()AnimationPlayerNode:animation_set_fps(fps)
Section titled “AnimationPlayerNode:animation_set_fps(fps)”Sets playback speed in frames per second.
self.node:get_node("AnimationPlayer"):animation_set_fps(12)fpsnumber
AnimationPlayerNode:animation_get_current()
Section titled “AnimationPlayerNode:animation_get_current()”Gets the name of the currently active animation track.
local current = self.node:get_node("AnimationPlayer"):animation_get_current()Returns string
In a scene file
Section titled “In a scene file”{ "type": "AnimationPlayerNode", "name": "AnimationPlayer", "position": [ 0, 0 ], "properties": { "reverse": false, "autoplay": false }}