Skip to content

Animation Player

Keyframe animation sequencer supporting property tracks, transitions, and timeline scrubbing.

Type: AnimationPlayerNode · Category: Animation & Effects · Also found as: animationplayer

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.

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)
  • event AnimationPlayerNodeEvent|string
  • handler fun(value: any, source: AnimationPlayerNode)

Returns integer id Connection id for disconnect

Reads an Inspector property by its path (vectors and colours as tables); “script.” reads a field of the node’s script.

local value = self.node:get_property("reverse")
  • path AnimationPlayerNodeProperty|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.” a field of the node’s script.

self.node:set_property("reverse", true)
  • path AnimationPlayerNodeProperty|string
  • value any
  • y? 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|string Animation name (the project’s complete)
  • blend? number Crossfade time in seconds (default 0)

Stops animation playback and freezes at current frame.

self.node:get_node("AnimationPlayer"):animation_stop()

Pauses animation playback.

self.node:get_node("AnimationPlayer"):animation_pause()

Resumes animation playback from the current frame.

self.node:get_node("AnimationPlayer"):animation_resume()

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)
  • fps number

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

{
"type": "AnimationPlayerNode",
"name": "AnimationPlayer",
"position": [
0,
0
],
"properties": {
"reverse": false,
"autoplay": false
}
}