Skeleton
Skeletal (cutout) animation from Spine or DragonBones exports: bones, meshes, skins, IK, events; crossfades; scripts can turn bones.
Type: SkeletonNode · Category: Animation & Effects · Also found as: skeleton, spine, dragonbones, bones, rig, cutout
Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
file |
string | "" |
The skeleton: a Spine .json export or a DragonBones _ske.json (project-relative). |
atlas |
string | "" |
Its texture atlas; empty = next to it (name.atlas for Spine, name_tex.json for DragonBones). |
armature |
string | "" |
DragonBones: the armature to show (empty = the first). |
animation |
string | "" |
The animation played when the scene starts (and shown in the editor). |
skin |
string | "" |
The skin (attachment set); empty = the default skin. |
loop |
boolean | true |
Play the animation over and over. |
autoplay |
boolean | true |
Start the animation when the node becomes ready. |
speed |
number | 1 |
Playback speed (1 = as authored). Range 0 to 5. |
mixTime |
number | 0.15 |
Seconds to crossfade from one animation to the next. Range 0 to 2. |
tint |
color | #ffffffff |
Multiplies every slot’s colour. |
showBones |
boolean | false |
Draw the bones over the art (also in the game, for debugging). |
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.
SkeletonNode:connect(event, handler)
Section titled “SkeletonNode: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)), skeleton_event (An event key of the skeleton’s animation fired (its name)); the tree events; custom ones.
self.node:connect("animation_finished", function(value, source) Log.info("animation_finished") end)eventSkeletonNodeEvent|stringhandlerfun(value:any, source: SkeletonNode)
Returns integer id Connection id for disconnect
SkeletonNode:get_property(path)
Section titled “SkeletonNode:get_property(path)”Reads an Inspector property by its path (vectors and colours as tables); “script.
local value = self.node:get_property("file")pathSkeletonNodeProperty|string
Returns any
SkeletonNode:set_property(path, value, y)
Section titled “SkeletonNode: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("file", "text")pathSkeletonNodeProperty|stringvalueanyy?number
SkeletonNode:skeleton_play(name, loop, mix)
Section titled “SkeletonNode:skeleton_play(name, loop, mix)”Plays an animation (crossfading over mix seconds; default: the node’s Mix Time). False when the skeleton has no such animation.
skel:skeleton_play("run")namestringloop?booleanDefault truemix?numberSeconds
Returns boolean ok
SkeletonNode:skeleton_stop()
Section titled “SkeletonNode:skeleton_stop()”Stops at the current frame.
skel:skeleton_stop()SkeletonNode:skeleton_is_playing()
Section titled “SkeletonNode:skeleton_is_playing()”An animation is playing.
if not skel:skeleton_is_playing() then skel:skeleton_play("idle") endReturns boolean
SkeletonNode:skeleton_set_skin(name)
Section titled “SkeletonNode:skeleton_set_skin(name)”Switches the skin (attachment set).
skel:skeleton_set_skin("armored")namestring
SkeletonNode:skeleton_animations()
Section titled “SkeletonNode:skeleton_animations()”The animations’ names.
for _, a in ipairs(skel:skeleton_animations()) do print(a) endReturns string[]
SkeletonNode:skeleton_skins()
Section titled “SkeletonNode:skeleton_skins()”The skins’ names.
local skins = skel:skeleton_skins()Returns string[]
SkeletonNode:skeleton_bones()
Section titled “SkeletonNode:skeleton_bones()”The bones’ names.
local bones = skel:skeleton_bones()Returns string[]
SkeletonNode:skeleton_bone_position(name)
Section titled “SkeletonNode:skeleton_bone_position(name)”A bone’s position in the world (nil: no such bone).
local muzzle = skel:skeleton_bone_position("gun_tip")namestring
Returns Vec2?
SkeletonNode:skeleton_bone_rotation(name)
Section titled “SkeletonNode:skeleton_bone_rotation(name)”A bone’s rotation in the world (degrees).
local angle = skel:skeleton_bone_rotation("arm")namestring
Returns number?
SkeletonNode:skeleton_set_bone_rotation(name, degrees)
Section titled “SkeletonNode:skeleton_set_bone_rotation(name, degrees)”Overrides a bone’s local rotation (degrees) over the animation; nil gives it back to the animation.
skel:skeleton_set_bone_rotation("arm", aim_angle)namestringdegrees?number
Returns boolean ok
SkeletonNode:skeleton_duration(name)
Section titled “SkeletonNode:skeleton_duration(name)”An animation’s length in seconds (default: the current one).
local t = skel:skeleton_duration("attack")name?string
Returns number
In a scene file
Section titled “In a scene file”{ "type": "SkeletonNode", "name": "Skeleton", "position": [ 0, 0 ], "properties": { "file": "", "atlas": "", "armature": "" }}