The Spine Runtimes are available for many programming languages. To simplify documentation, the API reference below is programming language agnostic. There may be minor differences for some languages, such as start caps for spine-csharp and class name prefixes on methods for spine-c.
Parameters cannot be null unless explicitly mentioned. Returns values will not be null unless explicitly mentioned.
This diagram illustrates how the various pieces of the runtimes fit together. Click for full resolution.
A simple container for a list of timelines and a name.
Animation Properties
duration: float
The duration of the animation in seconds, which is the highest time of all keys in the timeline.
name: string readonly
The animation's name, which is unique within the skeleton.
timelines: list<Timeline> readonly
Animation Methods
apply (Skeleton skeleton, float lastTime, float time, bool loop, list<Event> events, float alpha, bool setupPose, bool mixingOut): void
Applies all the animation's timelines to the specified skeleton.
See Timeline apply.
The interface for all timelines.
Timeline Properties
propertyId: int readonly
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
Timeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void
Applies this timeline to the skeleton.
  • skeleton The skeleton the timeline is being applied to. This provides access to the bones, slots, and other skeleton components the timeline may change.
  • lastTime The time this timeline was last applied. Timelines such as EventTimeline trigger only at specific times rather than every frame. In that case, the timeline triggers everything between lastTime (exclusive) and time (inclusive).
  • time The time within the animation. Most timelines find the key before and the key after this time so they can interpolate between the keys.
  • events If any events are fired, they are added to this list. Can be null to ignore firing events or if the timeline does not fire events.
  • alpha 0 results in the value of the current or setup pose (depending on setupPose). 1 results in the value from the timeline. Between 0 and 1 results in a value mixed between the current or setup pose and the value from the timeline. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other.
  • setupPose Controls mixing when alpha < 1. When true the value from the timeline is mixed with the value from the setup pose. When false the value from the timeline is mixed with the value from the current pose. Passing true when alpha is 1 is slightly more efficient for most timelines.
  • mixingOut True when changing alpha over time toward 0 (the setup or current pose), false when changing alpha toward 1 (the timeline's pose). Used for timelines which perform instant transitions, such as DrawOrderTimeline or AttachmentTimeline.
Changes a slot's attachment.
AttachmentTimeline Properties
attachmentNames: string[] readonly
The attachment name for each key frame. May contain null values to clear the attachment.
frameCount: int readonly
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds for each key frame.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
slotIndex: int
The index of the slot in slots that will be changed.
AttachmentTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
setFrame (int frameIndex, float time, string attachmentName): void
Sets the time in seconds and the attachment name for the specified key frame.
Changes a slot's color.
ColorTimeline Properties
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds, red, green, blue, and alpha values for each key frame.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
slotIndex: int
The index of the slot in slots that will be changed.
ColorTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float r, float g, float b, float a): void
Sets the time in seconds, red, green, blue, and alpha for the specified key frame.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
The base class for timelines that use interpolation between key frame values.
CurveTimeline Properties
frameCount: int readonly
The number of key frames for this timeline.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
CurveTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setLinear (int frameIndex): void
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void
Sets the specified key frame to stepped interpolation.
Changes a slot's attachmentVertices to deform a VertexAttachment.
DeformTimeline Properties
attachment: VertexAttachment
The attachment that will be deformed.
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds for each key frame.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
slotIndex: int
The index of the slot in slots that will be changed.
vertices: float[][] readonly
The vertices for each key frame.
DeformTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float[] vertices): void
Sets the time in seconds and the vertices for the specified key frame.
  • vertices Vertex positions for an unweighted VertexAttachment, or deform offsets if it has weights.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
Changes a skeleton's drawOrder.
DrawOrderTimeline Properties
drawOrders: int[][] readonly
The draw order for each key frame. See setFrame.
frameCount: int readonly
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds for each key frame.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
DrawOrderTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
setFrame (int frameIndex, float time, int[] drawOrder): void
Sets the time in seconds and the draw order for the specified key frame.
  • drawOrder For each slot in slots, the index of the new draw order. May be null to use setup pose draw order.
Fires an Event when specific animation times are reached.
EventTimeline Properties
events: Event[] readonly
The event for each key frame.
frameCount: int readonly
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds for each key frame.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
EventTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Fires events for frames > lastTime and <= time.
See Timeline apply.
setFrame (int frameIndex, Event event): void
Sets the time in seconds and the event for the specified key frame.
Changes an IK constraint's mix and bendDirection.
IkConstraintTimeline Properties
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds, mix, and bend direction for each key frame.
ikConstraintIndex: int
The index of the IK constraint slot in ikConstraints that will be changed.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
IkConstraintTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float mix, int bendDirection): void
Sets the time in seconds, mix, and bend direction for the specified key frame.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
Changes a path constraint's mixes.
PathConstraintMixTimeline Properties
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds, rotate mix, and translate mix for each key frame.
pathConstraintIndex: int
The index of the path constraint slot in pathConstraints that will be changed.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
PathConstraintMixTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float rotateMix, float translateMix): void
The time in seconds, rotate mix, and translate mix for the specified key frame.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
Changes a path constraint's position.
PathConstraintPositionTimeline Properties
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds and path constraint position for each key frame.
pathConstraintIndex: int
The index of the path constraint slot in pathConstraints that will be changed.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
PathConstraintPositionTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float position): void
Sets the time in seconds and path constraint position for the specified key frame.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
Changes a path constraint's spacing.
PathConstraintSpacingTimeline Properties
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly, from PathConstraintPositionTimeline
The time in seconds and path constraint position for each key frame.
pathConstraintIndex: int from PathConstraintPositionTimeline
The index of the path constraint slot in pathConstraints that will be changed.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
PathConstraintSpacingTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float position): void from PathConstraintPositionTimeline
Sets the time in seconds and path constraint position for the specified key frame.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
Changes a bone's local rotation.
RotateTimeline Properties
boneIndex: int
The index of the bone in bones that will be changed.
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds and rotation in degrees for each key frame.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
RotateTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float degrees): void
Sets the time in seconds and the rotation in degrees for the specified key frame.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
Changes a bone's local scaleX and scaleY.
ScaleTimeline Properties
boneIndex: int from TranslateTimeline
The index of the bone in bones that will be changed.
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly, from TranslateTimeline
The time in seconds, x, and y values for each key frame.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
ScaleTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float x, float y): void from TranslateTimeline
Sets the time in seconds, x, and y values for the specified key frame.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
Changes a bone's local shearX and shearY.
ShearTimeline Properties
boneIndex: int from TranslateTimeline
The index of the bone in bones that will be changed.
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly, from TranslateTimeline
The time in seconds, x, and y values for each key frame.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
ShearTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float x, float y): void from TranslateTimeline
Sets the time in seconds, x, and y values for the specified key frame.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
Changes a transform constraint's mixes.
TransformConstraintTimeline Properties
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds, rotate mix, translate mix, scale mix, and shear mix for each key frame.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
transformConstraintIndex: int
The index of the transform constraint slot in transformConstraints that will be changed.
TransformConstraintTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float rotateMix, float translateMix, float scaleMix, float shearMix): void
The time in seconds, rotate mix, translate mix, scale mix, and shear mix for the specified key frame.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
Changes a bone's local x and y.
TranslateTimeline Properties
boneIndex: int
The index of the bone in bones that will be changed.
frameCount: int readonly, from CurveTimeline
The number of key frames for this timeline.
frames: float[] readonly
The time in seconds, x, and y values for each key frame.
propertyId: int readonly, from Timeline
Uniquely encodes both the type of this timeline and the skeleton property that it affects.
TranslateTimeline Methods
apply (Skeleton skeleton, float lastTime, float time, list<Event> events, float alpha, bool setupPose, bool mixingOut): void from Timeline
Applies this timeline to the skeleton.
See Timeline apply.
getCurvePercent (int frameIndex, float percent): float from CurveTimeline
Returns the interpolated percentage for the specified key frame and linear percentage.
getCurveType (int frameIndex): float from CurveTimeline
Returns the interpolation type for the specified key frame.
  • <return value> Linear is 0, stepped is 1, Bezier is 2.
setCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2): void from CurveTimeline
Sets the specified key frame to Bezier interpolation. cx1 and cx2 are from 0 to 1, representing the percent of time between the two key frames. cy1 and cy2 are the percent of the difference between the key frame's values.
setFrame (int frameIndex, float time, float x, float y): void
Sets the time in seconds, x, and y values for the specified key frame.
setLinear (int frameIndex): void from CurveTimeline
Sets the specified key frame to linear interpolation.
setStepped (int frameIndex): void from CurveTimeline
Sets the specified key frame to stepped interpolation.
Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies multiple animations on top of each other (layering).
See Applying Animations in the Spine Runtimes Guide.
AnimationState Properties
data: AnimationStateData
The AnimationStateData to look up mix durations.
timeScale: float
Multiplier for the delta time when the animation state is updated, causing time for all animations to play slower or faster. Defaults to 1.
See TrackEntry timeScale for affecting a single animation.
tracks: list<TrackEntry> readonly
The list of tracks that currently have animations, which may contain null entries.
AnimationState Methods
addAnimation (int trackIndex, string animationName, bool loop, float delay): TrackEntry
Queues an animation by name.
See addAnimation.
addAnimation (int trackIndex, Animation animation, bool loop, float delay): TrackEntry
Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is equivalent to calling setAnimation.
  • delay Seconds to begin this animation after the start of the previous animation. May be <= 0 to use the animation duration of the previous track minus any mix duration plus the delay.
  • <return value> A track entry to allow further customization of animation playback. References to the track entry must not be kept after the dispose event occurs.
addEmptyAnimation (int trackIndex, float mixDuration, float delay): TrackEntry
Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's mixDuration. If the track is empty, it is equivalent to calling setEmptyAnimation.
  • delay Seconds to begin this animation after the start of the previous animation. May be <= 0 to use the animation duration of the previous track minus any mix duration plus delay.
  • <return value> A track entry to allow further customization of animation playback. References to the track entry must not be kept after the dispose event occurs.
addListener (AnimationStateListener listener): void
Adds a listener to receive events for all track entries.
apply (Skeleton skeleton): void
Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the animation state can be applied to multiple skeletons to pose them identically.
clearListenerNotifications (): void
Discards all listener notifications that have not yet been delivered. This can be useful to call from an AnimationStateListener when it is known that further notifications that may have been already queued for delivery are not wanted because new animations are being set.
clearListeners (): void
Removes all listeners added with addListener.
clearTrack (int trackIndex): void
Removes all animations from the track, leaving skeletons in their previous pose.
It may be desired to use setEmptyAnimation to mix the skeletons back to the setup pose, rather than leaving them in their previous pose.
clearTracks (): void
Removes all animations from all tracks, leaving skeletons in their previous pose.
It may be desired to use setEmptyAnimations to mix the skeletons back to the setup pose, rather than leaving them in their previous pose.
getCurrent (int trackIndex): TrackEntry
Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing.
removeListener (AnimationStateListener listener): void
Removes the listener added with addListener.
setAnimation (int trackIndex, string animationName, bool loop): TrackEntry
Sets an animation by name.
setAnimation.
setAnimation (int trackIndex, Animation animation, bool loop): TrackEntry
Sets the current animation for a track, discarding any queued animations.
  • loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its duration. In either case trackEnd determines when the track is cleared.
  • <return value> A track entry to allow further customization of animation playback. References to the track entry must not be kept after the dispose event occurs.
setEmptyAnimation (int trackIndex, float mixDuration): TrackEntry
Sets an empty animation for a track, discarding any queued animations, and sets the track entry's mixDuration.
Mixing out is done by setting an empty animation. A mix duration of 0 still mixes out over one frame.
To mix in, first set an empty animation and add an animation using addAnimation, then set the mixDuration on the returned track entry.
setEmptyAnimations (float mixDuration): void
Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix duration.
update (float delta): void
Increments each track entry trackTime, setting queued animations as current if needed.
Stores mix (crossfade) durations to be applied when AnimationState animations are changed.
AnimationStateData Properties
defaultMix: float
The mix duration to use when no mix duration has been defined between two animations.
skeletonData: SkeletonData readonly
The SkeletonData to look up animations when they are specified by name.
AnimationStateData Methods
getMix (Animation from, Animation to): float
Returns the mix duration to use when changing from the specified animation to the other, or the defaultMix if no mix duration has been set.
setMix (Animation from, Animation to, float duration): void
Sets the mix duration when changing from the specified animation to the other.
See mixDuration.
setMix (string fromName, string toName, float duration): void
Sets a mix duration by animation name.
See setMix.
The interface which can be implemented to receive TrackEntry events.
See TrackEntry listener and AnimationState addListener.
AnimationStateListener Methods
complete (TrackEntry entry): void
Invoked every time this entry's animation completes a loop.
dispose (TrackEntry entry): void
Invoked when this entry will be disposed. This may occur without the entry ever being set as the current entry. References to the entry should not be kept after dispose is called, as it may be destroyed or reused.
end (TrackEntry entry): void
Invoked when this entry is no longer the current entry and will never be applied again.
event (TrackEntry entry, Event event): void
Invoked when this entry's animation triggers an event.
interrupt (TrackEntry entry): void
Invoked when another entry has replaced this entry as the current entry. This entry may continue being applied for mixing.
start (TrackEntry entry): void
Invoked when this entry has been set as the current entry.
Stores settings and other state for the playback of an animation on an AnimationState track.
References to a track entry must not be kept after the dispose event occurs.
TrackEntry Properties
alpha: float
Values < 1 mix this animation with the setup pose or the skeleton's previous pose. Defaults to 1, which overwrites the skeleton's previous pose with this animation.
Typically track 0 is used to completely pose the skeleton, then alpha can be used on higher tracks. It doesn't make sense to use alpha on track 0 if the skeleton pose is from the last frame render.
animation: Animation
The animation to apply for this track entry.
animationEnd: float
Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will loop back to animationStart at this time. Defaults to the animation duration.
animationLast: float
The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this animation is applied, event timelines will fire all events between the animationLast time (exclusive) and animationTime (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation is applied.
animationStart: float
Seconds when this animation starts, both initially and after looping. Defaults to 0.
When changing the animationStart time, it often makes sense to set animationLast to the same value to prevent timeline keys before the start time from triggering.
animationTime: float readonly
Uses trackTime to compute the animationTime, which is between animationStart and animationEnd. When the trackTime is 0, the animationTime is equal to the animationStart time.
attachmentThreshold: float
When the mix percentage (mixTime / mixDuration) is less than the attachmentThreshold, attachment timelines for the animation being mixed out will be applied. Defaults to 0, so attachment timelines are not applied for an animation being mixed out.
delay: float
Seconds to postpone playing the animation. When a track entry is the current track entry, delay postpones incrementing the trackTime. When a track entry is queued, delay is the time from the start of the previous animation to when the track entry will become the current track entry.
drawOrderThreshold: float
When the mix percentage (mixTime / mixDuration) is less than the drawOrderThreshold, draw order timelines for the animation being mixed out will be applied. Defaults to 0, so draw order timelines are not applied for an animation being mixed out.
eventThreshold: float
When the mix percentage (mixTime / mixDuration) is less than the eventThreshold, event timelines for the animation being mixed out will be applied. Defaults to 0, so event timelines are not applied for an animation being mixed out.
listener: AnimationStateListener
The listener for events generated by this track entry, or null.
loop: bool
If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its duration.
mixDuration: float
Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData getMix based on the animation before this animation (if any).
The mixDuration must be set for a new track entry before update is next called.
mixTime: float
Seconds from 0 to the mixDuration when mixing from the previous animation to this animation. May be slightly more than mixDuration when the mix is complete. The mix time can be set manually rather than use the value from AnimationStateData getMix.
mixingFrom: TrackEntry readonly
The track entry for the previous animation when mixing from the previous animation to this animation, or null if no mixing is currently occuring. If mixing from multiple animations, mixingFrom makes up a linked list.
next: TrackEntry readonly
The animation queued to start after this animation, or null. next makes up a linked list.
timeScale: float
Multiplier for the delta time when the animation state is updated, causing time for this animation to pass slower or faster. Defaults to 1.
See AnimationState timeScale for affecting all animations.
trackEnd: float
The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the properties keyed by the animation are set to the setup pose and the track is cleared.
It may be desired to use addEmptyAnimation to mix the properties back to the setup pose over time, rather than have it happen instantly.
trackIndex: int readonly
The index of the track where this track entry is either current or queued.
See getCurrent.
trackTime: float
Current time in seconds this track entry has been the current track entry. The track time determines animationTime. The track time can be set to start the animation at a time other than 0, without affecting looping.
TrackEntry Methods
isComplete (): bool
Returns true if at least one loop has been completed.
See complete.
resetRotationDirections (): void
Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the long way around when using alpha and starting animations on other tracks.
Mixing involves finding a rotation between two others, which has two possible solutions: the short way or the long way around. The two rotations likely change over time, so which direction is the short or long way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the long way. TrackEntry chooses the short way the first time it is applied and remembers that direction.
Stores information about texture regions in one or more texture pages.
Creating an atlas takes the atlas data file and a TextureLoader.
Atlas Properties
pages: list<AtlasPage>
An atlas page for each texture.
regions: list<AtlasRegion>
The atlas regions across all pages.
Atlas Methods
dispose (): void
Uses the TextureLoader to unload each AtlasPage rendererObject.
findRegion (string name): AtlasRegion
Returns the first region found with the specified name, or null if it was not found. String comparison is used to find the region so the result should be cached rather than calling this method multiple times.
Settings for an atlas backing texture.
AtlasPage Properties
format: Format
The memory format to use for the texture.
height: int
The height in pixels of the image file.
magFilter: TextureFilter
The texture's magnification filter.
minFilter: TextureFilter
The texture's minification filter.
name: string
The name of the image file for the texture.
rendererObject: object
A game toolkit specific object used by rendering code, usually set by a TextureLoader.
See Loading skeleton data.
uWrap: TextureWrap
The X axis texture wrap setting.
vWrap: TextureWrap
The Y axis texture wrap setting.
width: int
The width in pixels of the image file.
A texture region on an atlas page.
AtlasRegion Properties
height: int
The height in pixels of the unrotated texture region after whitepace stripping.
index: int
The number at the end of the original image file name, or -1 if none.
When sprites are packed, if the original file name ends with a number, it is stored as the index and is not considered as part of the region's name. This is useful for keeping animation frames in order.
name: string
The name of the region.
offsetX: float
Pixels stripped from the left of the unrotated texture region.
offsetY: float
Pixels stripped from the bottom of the unrotated texture region.
originalHeight: int
The height in pixels of the unrotated texture region before whitespace stripping.
originalWidth: int
The width in pixels of the unrotated texture region before whitespace stripping.
pads: int[]
The ninepatch padding, or null if not a ninepatch or the ninepatch has no padding. Has 4 entries: left, right, top, bottom.
page: AtlasPage
The atlas page this region belongs to.
rotate: bool
If true, the texture region is stored in the atlas rotated 90 degrees counterclockwise.
splits: int[]
The ninepatch splits, or null if not a ninepatch. Has 4 entries: left, right, top, bottom.
u: float
The normalized (0-1) texture coordinate of the left edge of the texture region.
u2: float
The normalized (0-1) texture coordinate of the right edge of the texture region.
v: float
The normalized (0-1) texture coordinate of the top edge of the texture region.
v2: float
The normalized (0-1) texture coordinate of the bottom edge of the texture region.
width: int
The width in pixels of the unrotated texture region after whitespace stripping.
x: int
Pixels from the left edge of the texture to the left edge of the texture region.
y: int
Pixels from the bottom edge of the texture to the bottom edge of the texture region.
The memory format to use when loading an image into the AtlasPage texture.
Format Values
Alpha
Intensity
LuminanceAlpha
RGB565
RGBA4444
RGB888
RGBA8888
The filtering for magnification or minification of the AtlasPage texture.
TextureFilter Values
Nearest
Linear
MipMap
MipMapNearestNearest
MipMapLinearNearest
MipMapNearestLinear
MipMapLinearLinear
The interface which can be implemented to customize loading of AtlasPage images for an Atlas.
See Loading skeleton data.
TextureLoader Methods
load (AtlasPage page, string path): void
Loads a texture using the AtlasPage name or the image at the specified path and sets the AtlasPage rendererObject.
unload (object rendererObject): void
Unloads the rendererObject previously loaded in load.
The texture wrapping mode for UVs outside the AtlasPage texture.
TextureWrap Values
MirroredRepeat
ClampToEdge
Repeat
The base class for all attachments.
Attachment Properties
name: string readonly
The attachment's name.
An attachment with vertices that make up a polygon. Can be used for hit detection, creating physics bodies, spawning particle effects, and more.
See SkeletonBounds and Bounding Boxes in the Spine User Guide.
BoundingBoxAttachment Properties
bones: int[] from VertexAttachment
The bones which affect the vertices. The array entries are, for each vertex, the number of bones affecting the vertex followed by that many bone indices, which is the index of the bone in bones. Will be null if this attachment has no weights.
color: Color
The color of the bounding box as it was in Spine. Available only when nonessential data was exported. Bounding boxes are not usually rendered at runtime.
name: string readonly, from Attachment
The attachment's name.
vertices: float[] from VertexAttachment
The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are x,y entries for each vertex. For a weighted attachment, the values are x,y,weight entries for each bone affecting each vertex.
worldVerticesLength: int from VertexAttachment
The maximum length required of the worldVertices passed to computeWorldVertices.
BoundingBoxAttachment Methods
applyDeform (VertexAttachment sourceAttachment): bool from VertexAttachment
Returns true if a deform originally applied to the specified attachment should be applied to this attachment. The default implementation returns true only when sourceAttachment is this attachment.
computeWorldVertices (Slot slot, int start, int count, float[] worldVertices, int offset): void from VertexAttachment
Transforms the attachment's local vertices to world coordinates. If the slot has attachmentVertices, they are used to deform the vertices.
See World transforms in the Spine Runtimes Guide.
See VertexAttachment computeWorldVertices.
computeWorldVertices (Slot slot, float[] worldVertices): void from VertexAttachment
Transforms the attachment's local vertices to world coordinates, using 0 for start and offset.
See computeWorldVertices.
An attachment that displays a textured mesh. A mesh has hull vertices and internal vertices within the hull. Holes are not supported. Each vertex has UVs (texture coordinates) and triangles are used to map an image on to the mesh.
See Mesh attachments in the Spine User Guide.
MeshAttachment Properties
bones: int[] from VertexAttachment
The bones which affect the vertices. The array entries are, for each vertex, the number of bones affecting the vertex followed by that many bone indices, which is the index of the bone in bones. Will be null if this attachment has no weights.
color: Color
The color to tint the mesh.
edges: int[]
Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if nonessential data was exported. Triangulation is not performed at runtime.
height: float
The height of the mesh's image. Available only when nonessential data was exported.
hullLength: int
The number of entries at the beginning of vertices that make up the mesh hull.
inheritDeform: bool
When this is a linked mesh (see parentMesh), if true, any DeformTimeline for the parentMesh is also applied to this mesh. If false, this linked mesh may have its own deform timelines.
See applyDeform.
name: string readonly, from Attachment
The attachment's name.
parentMesh: MeshAttachment
The parent mesh if this is a linked mesh, else null. A linked mesh shares the bones, vertices, regionUVs, triangles, hullLength, edges, width, and height with the parent mesh, but may have a different name or path (and therefore a different texture).
path: string
The name of the texture region for this attachment.
regionHeight: float
The height in pixels of the unrotated texture region after whitepace stripping.
regionOffsetX: float
Pixels stripped from the left of the unrotated texture region.
regionOffsetY: float
Pixels stripped from the bottom of the unrotated texture region.
regionOriginalHeight: float
The height in pixels of the unrotated texture region before whitespace stripping.
regionOriginalWidth: float
The width in pixels of the unrotated texture region before whitespace stripping.
regionRotate: bool
If true, the texture region is stored in the atlas rotated 90 degrees counterclockwise.
regionU: float
The normalized (0-1) texture coordinate of the left edge of the texture region.
regionU2: float
The normalized (0-1) texture coordinate of the right edge of the texture region.
regionUVs: float[]
regionUVs: float[]
The UV pair for each vertex, normalized within the texture region.
regionV: float
The normalized (0-1) texture coordinate of the top edge of the texture region.
regionV2: float
The normalized (0-1) texture coordinate of the bottom edge of the texture region.
regionWidth: float
The width in pixels of the unrotated texture region after whitespace stripping.
rendererObject: object
A game toolkit specific object used by rendering code, usually set by an AttachmentLoader.
See Generic rendering
triangles: int[]
Triplets of vertex indices which describe the mesh's triangulation.
uvs: float[]
The UV pair for each vertex, normalized within the entire texture.
See updateUVs.
vertices: float[] from VertexAttachment
The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are x,y entries for each vertex. For a weighted attachment, the values are x,y,weight entries for each bone affecting each vertex.
width: float
The width of the mesh's image. Available only when nonessential data was exported.
worldVerticesLength: int from VertexAttachment
The maximum length required of the worldVertices passed to computeWorldVertices.
MeshAttachment Methods
applyDeform (VertexAttachment sourceAttachment): bool from VertexAttachment
Returns true if the sourceAttachment is this mesh, else returns true if inheritDeform is true and the the sourceAttachment is the parentMesh.
computeWorldVertices (Slot slot, int start, int count, float[] worldVertices, int offset): void from VertexAttachment
Transforms the attachment's local vertices to world coordinates. If the slot has attachmentVertices, they are used to deform the vertices.
See World transforms in the Spine Runtimes Guide.
See VertexAttachment computeWorldVertices.
computeWorldVertices (Slot slot, float[] worldVertices): void from VertexAttachment
Transforms the attachment's local vertices to world coordinates, using 0 for start and offset.
See computeWorldVertices.
updateUVs (): void
Calculates the uvs using the regionUVs and other region settings. Must be called after changing region settings.
An attachment whose vertices make up a composite Bezier curve.
See PathConstraint and Paths in the Spine User Guide.
PathAttachment Properties
bones: int[] from VertexAttachment
The bones which affect the vertices. The array entries are, for each vertex, the number of bones affecting the vertex followed by that many bone indices, which is the index of the bone in bones. Will be null if this attachment has no weights.
closed: bool
If true, the start and end knots are connected.
color: Color
The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually rendered at runtime.
constantSpeed: bool
If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer calculations are performed but calculating positions along the path is less accurate.
lengths: float[]
The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve.
name: string readonly, from Attachment
The attachment's name.
vertices: float[] from VertexAttachment
The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are x,y entries for each vertex. For a weighted attachment, the values are x,y,weight entries for each bone affecting each vertex.
worldVerticesLength: int from VertexAttachment
The maximum length required of the worldVertices passed to computeWorldVertices.
PathAttachment Methods
applyDeform (VertexAttachment sourceAttachment): bool from VertexAttachment
Returns true if a deform originally applied to the specified attachment should be applied to this attachment. The default implementation returns true only when sourceAttachment is this attachment.
computeWorldVertices (Slot slot, int start, int count, float[] worldVertices, int offset): void from VertexAttachment
Transforms the attachment's local vertices to world coordinates. If the slot has attachmentVertices, they are used to deform the vertices.
See World transforms in the Spine Runtimes Guide.
See VertexAttachment computeWorldVertices.
computeWorldVertices (Slot slot, float[] worldVertices): void from VertexAttachment
Transforms the attachment's local vertices to world coordinates, using 0 for start and offset.
See computeWorldVertices.
An attachment that displays a textured quadrilateral.
See Region attachments in the Spine User Guide.
RegionAttachment Properties
color: Color
The color to tint the region attachment.
height: float
The height of the region attachment in Spine.
name: string readonly, from Attachment
The attachment's name.
offset: float[] readonly
For each of the 4 vertices, a pair of x,y values that is the local position of the vertex.
See updateOffset.
path: string
The name of the texture region for this attachment.
regionHeight: float
The height in pixels of the unrotated texture region after whitepace stripping.
regionOffsetX: float
Pixels stripped from the left of the unrotated texture region.
regionOffsetY: float
Pixels stripped from the bottom of the unrotated texture region.
regionOriginalHeight: float
The height in pixels of the unrotated texture region before whitespace stripping.
regionOriginalWidth: float
The width in pixels of the unrotated texture region before whitespace stripping.
regionWidth: float
The width in pixels of the unrotated texture region after whitespace stripping.
rendererObject: object
A game toolkit specific object used by rendering code, usually set by an AttachmentLoader.
See Generic rendering
rotation: float
The local rotation.
scaleX: float
The local scaleX.
scaleY: float
The local scaleY.
width: float
The width of the region attachment in Spine.
x: float
The local x translation.
y: float
The local y translation.
RegionAttachment Methods
computeWorldVertices (Bone bone, float[] worldVertices): void
setUVs (float u, float v, float u2, float v2, bool rotate): void
Sets the normalized (0-1) texture coordinates of the left, top, right, and bottom edges of the texture region.
  • u The left edge.
  • v The top edge.
  • u2 The right edge.
  • v2 The bottom edge.
  • rotate If true, the texture region is stored in the atlas rotated 90 degrees counterclockwise.
updateOffset (): void
Calculates the offset using the region settings. Must be called after changing region settings.
Base class for an attachment with vertices that are transformed by one or more bones and can be deformed by a slot's attachmentVertices.
VertexAttachment Properties
bones: int[]
The bones which affect the vertices. The array entries are, for each vertex, the number of bones affecting the vertex followed by that many bone indices, which is the index of the bone in bones. Will be null if this attachment has no weights.
name: string readonly, from Attachment
The attachment's name.
vertices: float[]
The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are x,y entries for each vertex. For a weighted attachment, the values are x,y,weight entries for each bone affecting each vertex.
worldVerticesLength: int
The maximum length required of the worldVertices passed to computeWorldVertices.
VertexAttachment Methods
applyDeform (VertexAttachment sourceAttachment): bool
Returns true if a deform originally applied to the specified attachment should be applied to this attachment. The default implementation returns true only when sourceAttachment is this attachment.
computeWorldVertices (Slot slot, int start, int count, float[] worldVertices, int offset): void
Transforms the attachment's local vertices to world coordinates. If the slot has attachmentVertices, they are used to deform the vertices.
See World transforms in the Spine Runtimes Guide.
  • start The index of the first vertices value to transform. Each vertex has 2 values, x and y.
  • count The number of world vertex values to output. Must be <= worldVerticesLength - start.
  • worldVertices The output world vertices. Must have a length >= offset + count.
  • offset The worldVertices index to begin writing values.
computeWorldVertices (Slot slot, float[] worldVertices): void
Transforms the attachment's local vertices to world coordinates, using 0 for start and offset.
See computeWorldVertices.
The interface which can be implemented to customize creating and populating attachments.
See Loading skeleton data in the Spine Runtimes Guide.
AttachmentLoader Methods
newBoundingBoxAttachment (Skin skin, string name): BoundingBoxAttachment
  • <return value> May be null to not load the attachment.
newMeshAttachment (Skin skin, string name, string path): MeshAttachment
  • <return value> May be null to not load the attachment.
newPathAttachment (Skin skin, string name): PathAttachment
  • <return value> May be null to not load the attachment.
newRegionAttachment (Skin skin, string name, string path): RegionAttachment
  • <return value> May be null to not load the attachment.
An AttachmentLoader that configures attachments using texture regions from an Atlas.
See Loading skeleton data in the Spine Runtimes Guide.
AtlasAttachmentLoader Methods
newBoundingBoxAttachment (Skin skin, string name): BoundingBoxAttachment from AttachmentLoader
newMeshAttachment (Skin skin, string name, string path): MeshAttachment from AttachmentLoader
newPathAttachment (Skin skin, string name): PathAttachment from AttachmentLoader
newRegionAttachment (Skin skin, string name, string path): RegionAttachment from AttachmentLoader
Stores the setup pose for a Bone.
BoneData Properties
color: Color
The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually rendered at runtime.
index: int readonly
The index of the bone in bones.
length: float
The bone's length.
name: string readonly
The name of the bone, which is unique within the skeleton.
parent: BoneData readonly
May be null.
rotation: float
The local rotation.
scaleX: float
The local scaleX.
scaleY: float
The local scaleY.
shearX: float
The local shearX.
shearY: float
The local shearX.
transformMode: TransformMode
The transform mode for how parent world transforms affect this bone.
x: float
The local x translation.
y: float
The local y translation.
Stores a bone's current pose.
Bone Properties
a: float readonly
Part of the world transform matrix for the X axis.
b: float readonly
Part of the world transform matrix for the Y axis.
c: float readonly
Part of the world transform matrix for the X axis.
children: list<Bone> readonly
The immediate children of this bone.
d: float readonly
Part of the world transform matrix for the Y axis.
data: BoneData readonly
The bone's setup pose data.
parent: Bone readonly
The parent bone, or null if this is the root bone.
rotation: float
The local rotation.
scaleX: float
The local scaleX.
scaleY: float
The local scaleY.
shearX: float
The local shearX.
shearY: float
The local shearY.
skeleton: Skeleton readonly
The skeleton this bone belongs to.
worldRotationX: float readonly
The world rotation for the X axis, calculated using a and c.
worldRotationY: float readonly
The world rotation for the Y axis, calculated using b and d.
worldScaleX: float readonly
The magnitude (always positive) of the world scale X, calculated using a and c.
worldScaleY: float readonly
The magnitude (always positive) of the world scale Y, calculated using b and d.
worldX: float readonly
The world X position.
worldY: float readonly
The world Y position.
x: float
The local x translation.
y: float
The local y translation.
Bone Methods
localToWorld (2-tuple local): 2-tuple
Transforms a point from the bone's local coordinates to world coordinates.
rotateWorld (float degrees): void
Rotates the world transform the specified amount. updateWorldTransform will need to be called on any child bones, recursively.
setToSetupPose (): void
Sets this bone's local transform to the setup pose.
updateWorldTransform (float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY): void
Computes the world transform using the parent bone and the specified local transform. Child bones are not updated.
See World transforms in the Spine Runtimes Guide.
updateWorldTransform (): void
Computes the world transform using the parent bone and this bone's local transform.
See updateWorldTransform.
worldToLocal (2-tuple world): 2-tuple
Transforms a point from world coordinates to the bone's local coordinates.
Determines how a bone inherits world transforms from parent bones.
TransformMode Values
normal
onlyTranslation
noRotationOrReflection
noScale
noScaleOrReflection
The interface for all constraints.
Constraint Properties
order: int readonly
The ordinal for the order a skeleton's constraints will be applied.
Stores the setup pose for an IkConstraint.
See IK constraints in the Spine User Guide.
IkConstraintData Properties
bendDirection: int
Controls the bend direction of the IK bones, either 1 or -1.
bones: list<BoneData> readonly
The bones that are constrained by this IK constraint.
mix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained rotations.
name: string readonly
The IK constraint's name, which is unique within the skeleton.
order: int
See order.
target: BoneData
The bone that is the IK target.
Stores the current pose for an IK constraint. An IK constraint adjusts the rotation of 1 or 2 constrained bones so the tip of the last bone is as close to the target bone as possible.
See IK constraints in the Spine User Guide.
IkConstraint Properties
bendDirection: int
Controls the bend direction of the IK bones, either 1 or -1.
bones: list<Bone> readonly
The bones that will be modified by this IK constraint.
data: IkConstraintData readonly
The IK constraint's setup pose data.
mix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained rotations.
order: int readonly, from Constraint
The ordinal for the order a skeleton's constraints will be applied.
target: Bone
The bone that is the IK target.
IkConstraint Methods
apply (): void
Applies the constraint to the constrained bones.
apply (Bone parent, Bone child, float targetX, float targetY, int bendDir, float alpha): void static
Applies 2 bone IK. The target is specified in the world coordinate system.
  • child A direct descendant of the parent bone.
apply (Bone bone, float targetX, float targetY, float alpha): void static
Applies 1 bone IK. The target is specified in the world coordinate system.
Stores the setup pose for a PathConstraint.
See Path constraints in the Spine User Guide.
PathConstraintData Properties
bones: list<BoneData> readonly
The bones that will be modified by this path constraint.
name: string readonly
The path constraint's name, which is unique within the skeleton.
offsetRotation: float
An offset added to the constrained bone rotation.
order: int
See order.
position: float
The position along the path.
positionMode: PositionMode
The mode for positioning the first bone on the path.
rotateMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained rotations.
rotateMode: RotateMode
The mode for adjusting the rotation of the bones.
spacing: float
The spacing between bones.
spacingMode: SpacingMode
The mode for positioning the bones after the first bone on the path.
target: SlotData
The slot whose path attachment will be used to constrained the bones.
translateMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained translations.
Stores the current pose for a path constraint. A path constraint adjusts the rotation, translation, and scale of the constrained bones so they follow a PathAttachment.
See Path constraints in the Spine User Guide.
PathConstraint Properties
bones: list<Bone> readonly
The bones that will be modified by this path constraint.
data: PathConstraintData readonly
The path constraint's setup pose data.
order: int readonly, from Constraint
The ordinal for the order a skeleton's constraints will be applied.
position: float
The position along the path.
rotateMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained rotations.
spacing: float
The spacing between bones.
target: Slot
The slot whose path attachment will be used to constrained the bones.
translateMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained translations.
PathConstraint Methods
apply (): void
Applies the constraint to the constrained bones.
Controls how the first bone is positioned along the path.
See Position mode in the Spine User Guide.
PositionMode Values
fixed
percent
Controls how bones are rotated, translated, and scaled to match the path.
See Rotate mode in the Spine User Guide.
RotateMode Values
tangent
chain
chainScale
Controls how bones after the first bone are positioned along the path.
See Spacing mode in the Spine User Guide.
SpacingMode Values
length
fixed
percent
Stores the setup pose for a TransformConstraint.
See Transform constraints in the Spine User Guide.
TransformConstraintData Properties
bones: list<BoneData> readonly
The bones that will be modified by this transform constraint.
name: string readonly
The transform constraint's name, which is unique within the skeleton.
offsetRotation: float
An offset added to the constrained bone rotation.
offsetScaleX: float
An offset added to the constrained bone scaleX.
offsetScaleY: float
An offset added to the constrained bone scaleY.
offsetShearY: float
An offset added to the constrained bone shearY.
offsetX: float
An offset added to the constrained bone X translation.
offsetY: float
An offset added to the constrained bone Y translation.
order: int
See order.
rotateMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained rotations.
scaleMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained scales.
shearMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained shears.
target: BoneData
The target bone whose world transform will be copied to the constrained bones.
translateMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained translations.
Stores the current pose for a transform constraint. A transform constraint adjusts the world transform of the constrained bones to match that of the target bone.
See Transform constraints in the Spine User Guide.
TransformConstraint Properties
bones: list<Bone> readonly
The bones that will be modified by this transform constraint.
data: TransformConstraintData readonly
The transform constraint's setup pose data.
order: int readonly, from Constraint
The ordinal for the order a skeleton's constraints will be applied.
rotateMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained rotations.
scaleMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained scales.
shearMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained scales.
target: Bone
The target bone whose world transform will be copied to the constrained bones.
translateMix: float
A percentage (0-1) that controls the mix between the constrained and unconstrained translations.
TransformConstraint Methods
apply (): void
Applies the constraint to the constrained bones.
Stores the setup pose values for an Event.
See Events in the Spine User Guide.
EventData Properties
float: float
floatValue: float
The event's float value.
int: int
intValue: int
The event's int value.
name: string readonly
The name of the event, which is unique within the skeleton.
string: string
stringValue: string
The event's string value or an empty string.
Stores the current pose values for an Event.
See Timeline apply, AnimationStateListener event, and Events in the Spine User Guide.
Event Properties
data: EventData readonly
The events's setup pose data.
float: float
floatValue: float
The event's float value.
int: int
intValue: int
The event's int value.
string: string
stringValue: string
The event's string value or an empty string.
time: float readonly
The animation time this event was keyed.
Loads skeleton data in the Spine binary format.
See Spine binary format and JSON and binary data in the Spine Runtimes Guide.
SkeletonBinary Properties
scale: float
Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at runtime than were used in Spine.
See Scaling in the Spine Runtimes Guide.
SkeletonBinary Methods
readSkeletonData (byte[] bytes): SkeletonData
Deserializes the Spine binary data into a SkeletonData object.
Collects each BoundingBoxAttachment that is visible and computes the world vertices for its polygon. The polygon vertices are provided along with convenience methods for doing hit detection.
SkeletonBounds Properties
boundingBoxes: list<BoundingBoxAttachment> readonly
The visible bounding boxes.
height: float readonly
The height of the axis aligned bounding box.
maxX: float readonly
The right edge of the axis aligned bounding box.
maxY: float readonly
The top edge of the axis aligned bounding box.
minX: float readonly
The left edge of the axis aligned bounding box.
minY: float readonly
The bottom edge of the axis aligned bounding box.
polygons: list<float[]> readonly
The world vertices for the bounding box polygons.
width: float readonly
The width of the axis aligned bounding box.
SkeletonBounds Methods
aabbContainsPoint (float x, float y): bool
Returns true if the axis aligned bounding box contains the point.
aabbIntersectsSegment (float x1, float y1, float x2, float y2): bool
Returns true if the axis aligned bounding box intersects the line segment.
aabbIntersectsSkeleton (SkeletonBounds bounds): bool
Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds.
containsPoint (float[] polygon, float x, float y): bool
Returns true if the polygon contains the point.
containsPoint (float x, float y): BoundingBoxAttachment
Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more efficient to only call this method if aabbContainsPoint returns true.
getPolygon (BoundingBoxAttachment boundingBox): float[]
Returns the polygon for the specified bounding box, or null.
intersectsSegment (float[] polygon, float x1, float y1, float x2, float y2): bool
Returns true if the polygon contains any part of the line segment.
intersectsSegment (float x1, float y1, float x2, float y2): BoundingBoxAttachment
Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it is usually more efficient to only call this method if aabbIntersectsSegment returns true.
update (Skeleton skeleton, bool updateAabb): void
Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding box's polygon.
  • updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the SkeletonBounds AABB methods will always return true.
Stores the setup pose and all of the stateless data for a skeleton.
See Data objects in the Spine Runtimes Guide.
SkeletonData Properties
animations: list<Animation> readonly
The skeleton's animations.
bones: list<BoneData> readonly
The skeleton's bones, sorted parent first. The root bone is always the first bone.
defaultSkin: Skin
The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
See getAttachment. May be null.
events: list<EventData> readonly
The skeleton's events.
fps: float
The dopesheet FPS in Spine. Available only when nonessential data was exported.
hash: string
The skeleton data hash. This value will change if any of the skeleton data has changed. May be null.
height: float
The height of the skeleton's axis aligned bounding box in the setup pose.
ikConstraints: list<IkConstraintData> readonly
The skeleton's IK constraints.
imagesPath: string
The path to the image directory as defined in Spine. Available only when nonessential data was exported. May be null.
name: string
The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null.
pathConstraints: list<PathConstraintData> readonly
The skeleton's path constraints.
skins: list<Skin> readonly
All skins, including the default skin.
slots: list<SlotData> readonly
The skeleton's slots.
transformConstraints: list<TransformConstraintData> readonly
The skeleton's transform constraints.
version: string
The Spine version used to export the skeleton data, or null.
width: float
The width of the skeleton's axis aligned bounding box in the setup pose.
SkeletonData Methods
findAnimation (string animationName): Animation
Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findBone (string boneName): BoneData
Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findEvent (string eventDataName): EventData
Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findIkConstraint (string constraintName): IkConstraintData
Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findPathConstraint (string constraintName): PathConstraintData
Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findSkin (string skinName): Skin
Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findSlot (string slotName): SlotData
Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findTransformConstraint (string constraintName): TransformConstraintData
Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
Stores the current pose for a skeleton.
See Instance objects in the Spine Runtimes Guide.
Skeleton Properties
bones: list<Bone> readonly
The skeleton's bones, sorted parent first. The root bone is always the first bone.
color: Color
The color to tint all the skeleton's attachments.
data: SkeletonData readonly
The skeleton's setup pose data.
drawOrder: list<Slot>
The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order.
flipX: bool
If true, the entire skeleton is flipped over the Y axis. This affects all bones, even if the bone's transform mode disallows scale inheritance.
flipY: bool
If true, the entire skeleton is flipped over the X axis. This affects all bones, even if the bone's transform mode disallows scale inheritance.
ikConstraints: list<IkConstraint> readonly
The skeleton's IK constraints.
pathConstraints: list<PathConstraint> readonly
The skeleton's path constraints.
rootBone: Bone readonly
The root bone, or null.
skin: Skin
The skeleton's current skin. May be null.
slots: list<Slot> readonly
The skeleton's slots.
time: float
The skeleton's time. This can be used for tracking, such as with Slot attachmentTime.
See update.
transformConstraints: list<TransformConstraint> readonly
The skeleton's transform constraints.
x: float
Sets the skeleton X position, which is added to the root bone worldX position.
y: float
Sets the skeleton Y position, which is added to the root bone worldY position.
Skeleton Methods
findBone (string boneName): Bone
Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findIkConstraint (string constraintName): IkConstraint
Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findPathConstraint (string constraintName): PathConstraint
Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findSlot (string slotName): Slot
Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
findTransformConstraint (string constraintName): TransformConstraint
Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of this method than to call it multiple times.
  • <return value> May be null.
getAttachment (int slotIndex, string attachmentName): Attachment
Finds an attachment by looking in the skin and defaultSkin using the slot index and attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
See Runtime skins in the Spine Runtimes Guide.
  • <return value> May be null.
getAttachment (string slotName, string attachmentName): Attachment
Finds an attachment by looking in the skin and defaultSkin using the slot name and attachment name.
See getAttachment.
  • <return value> May be null.
getBounds (2-tuple offset, 2-tuple size): void
Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
  • offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
  • size An output value, the width and height of the AABB.
setAttachment (string slotName, string attachmentName): void
A convenience method to set an attachment by finding the slot with findSlot, finding the attachment with getAttachment, then setting the slot's attachment.
  • attachmentName May be null to clear the slot.
setBonesToSetupPose (): void
Sets the bones and constraints to their setup pose values.
setSkin (Skin skin): void
Sets the skin used to look up attachments before looking in the defaultSkin.
Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no old skin, each slot's setup mode attachment is attached from the new skin.
  • skin May be null.
setSkin (string name): void
Sets a skin by name.
See setSkin.
setSlotsToSetupPose (): void
Sets the slots and draw order to their setup pose values.
setToSetupPose (): void
Sets the bones, constraints, slots, and draw order to their setup pose values.
update (float delta): void
Increments the skeleton's time.
updateCache (): void
Caches information about bones and constraints. Must be called if bones, constraints, or weighted path attachments are added or removed.
updateWorldTransform (): void
Updates the world transform for each bone and applies all constraints.
See World transforms in the Spine Runtimes Guide.
Loads skeleton data in the Spine JSON format.
See Spine JSON format and JSON and binary data in the Spine Runtimes Guide.
SkeletonJson Properties
scale: float
Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at runtime than were used in Spine.
See Scaling in the Spine Runtimes Guide.
SkeletonJson Methods
readSkeletonData (string json): SkeletonData
Deserializes the Spine JSON data into a SkeletonData object.
Stores attachments by slot index and attachment name.
See SkeletonData defaultSkin, Skeleton skin, and Runtime skins in the Spine Runtimes Guide.
Skin Properties
name: string readonly
The skin's name, which is unique within the skeleton.
Skin Methods
addAttachment (int slotIndex, string name, Attachment attachment): void
Adds an attachment to the skin for the specified slot index and name.
getAttachment (int slotIndex, string name): Attachment
Returns the attachment for the specified slot index and name, or null.
Stores the setup pose for a Slot.
SlotData Properties
attachmentName: string
The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible.
blendMode: BlendMode
The blend mode for drawing the slot's attachment.
boneData: BoneData readonly
The bone this slot belongs to.
color: Color
The color used to tint the slot's attachment.
index: int readonly
The index of the slot in slots.
name: string readonly
The name of the slot, which is unique within the skeleton.
Determines how images are blended with existing pixels when drawn.
BlendMode Values
normal
additive
multiply
screen
Stores a slot's current pose. Slots organize attachments for drawOrder purposes and provide a place to store state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared across multiple skeletons.
Slot Properties
attachment: Attachment
The current attachment for the slot, or null if the slot has no attachment.
attachmentTime: float
The time that has elapsed since the last time the attachment was set or cleared. Relies on Skeleton time.
attachmentVertices: float[]
Vertices to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
See computeWorldVertices and DeformTimeline.
bone: Bone readonly
The bone this slot belongs to.
color: Color
The color used to tint the slot's attachment.
data: SlotData readonly
The slot's setup pose data.
skeleton: Skeleton readonly
The skeleton this slot belongs to.
Slot Methods
setToSetupPose (): void
Sets this slot to the setup pose.

Previous: Runtime Skins