Skeleton

spine.Skeleton (Class)

Stores the current pose for a skeleton.

See Instance objects in the Spine Runtimes Guide.

Instance Members

spine
data: SkeletonData








spine
skin: Skin


spine
time: Float

spine
scaleX: Float

spine
scaleY: Float

spine
x: Float

spine
y: Float

spine
updateCache(): Void

Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones, constraints, or weighted path attachments are added or removed.


spine
updateWorldTransform(): Void

Updates the world transform for each bone and applies all constraints.

See World transforms in the Spine Runtimes Guide.


spine
updateWorldTransformWithParent(parent: Bone): Void

Temporarily sets the root bone as a child of the specified bone, then updates the world transform for each bone and applies all constraints.

See World transforms in the Spine Runtimes Guide.

Name Type
parent Bone

spine
setToSetupPose(): Void

Sets the bones, constraints, slots, and draw order to their setup pose values.


spine
setBonesToSetupPose(): Void

Sets the bones and constraints to their setup pose values.


spine
setSlotsToSetupPose(): Void

Sets the slots and draw order to their setup pose values.


spine
getData(): SkeletonData

The skeleton's setup pose data.

Returns
SkeletonData

The skeleton's bones, sorted parent first. The root bone is always the first bone.

Returns
spine.support.utils.Array<Bone>

spine
getUpdateCache(): spine.support.utils.Array<Updatable>

The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}.

Returns
spine.support.utils.Array<Updatable>

spine
getRootBone(): Bone

Returns the root bone, or null if the skeleton has no bones.

Returns
Bone

spine
findBone(boneName: String): 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 repeatedly.

Name Type
boneName String
Returns
Bone

The skeleton's slots.

Returns
spine.support.utils.Array<Slot>

spine
findSlot(slotName: String): 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 repeatedly.

Name Type
slotName String
Returns
Slot

spine
getDrawOrder(): spine.support.utils.Array<Slot>

The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order.

Returns
spine.support.utils.Array<Slot>

spine
setDrawOrder(drawOrder: spine.support.utils.Array<Slot>): Void
Name Type
drawOrder spine.support.utils.Array<Slot>

spine
getSkin(): Skin

The skeleton's current skin.

Returns
Skin

spine
setSkinByName(skinName: String): Void

Sets a skin by name.

See {@link #setSkin(Skin)}.

Name Type
skinName String

spine
setSkin(newSkin: Skin): Void

Sets the skin used to look up attachments before looking in the {@link SkeletonData#getDefaultSkin() default skin}. If the skin is changed, {@link #updateCache()} is called.

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.

After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply(Skeleton)} is called before the next time the skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.

Name Type
newSkin Skin

spine
getAttachmentWithSlotName(slotName: String, attachmentName: String): spine.attachments.Attachment

Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment name.

See {@link #getAttachment(int, String)}.

Name Type
slotName String
attachmentName String
Returns
spine.attachments.Attachment

spine
getAttachment(slotIndex: Int, attachmentName: String): spine.attachments.Attachment

Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#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.

Name Type
slotIndex Int
attachmentName String
Returns
spine.attachments.Attachment

spine
setAttachment(slotName: String, attachmentName: String): Void

A convenience method to set an attachment by finding the slot with {@link #findSlot(String)}, finding the attachment with {@link #getAttachment(int, String)}, then setting the slot's {@link Slot#attachment}.

Name Type Description
slotName String
attachmentName String May be null to clear the slot's attachment.

spine
getIkConstraints(): spine.support.utils.Array<IkConstraint>

The skeleton's IK constraints.

Returns
spine.support.utils.Array<IkConstraint>

spine
findIkConstraint(constraintName: String): 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 repeatedly.

Name Type
constraintName String
Returns
IkConstraint

spine
getTransformConstraints(): spine.support.utils.Array<TransformConstraint>

The skeleton's transform constraints.

Returns
spine.support.utils.Array<TransformConstraint>

spine
findTransformConstraint(constraintName: String): 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 repeatedly.

Name Type
constraintName String
Returns
TransformConstraint

spine
getPathConstraints(): spine.support.utils.Array<PathConstraint>

The skeleton's path constraints.

Returns
spine.support.utils.Array<PathConstraint>

spine
findPathConstraint(constraintName: String): 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 repeatedly.

Name Type
constraintName String
Returns
PathConstraint

Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.

Name Type Description
offset spine.support.math.Vector2 An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
size spine.support.math.Vector2 An output value, the width and height of the AABB.
temp spine.support.utils.FloatArray Working memory to temporarily store attachments' computed world vertices.

The color to tint all the skeleton's attachments.

Returns
spine.support.graphics.Color

spine
setColor(color: spine.support.graphics.Color): Void

A convenience method for setting the skeleton color. The color can also be set by modifying {@link #getColor()}.

Name Type
color spine.support.graphics.Color

spine
setColorWithRGBA(r: Float, g: Float, b: Float, a: Float): Void

A convenience method for setting the skeleton color. The color can also be set by modifying {@link #getColor()}.

Name Type
r Float
g Float
b Float
a Float

spine
getScaleX(): Float

Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale inheritance.

Returns
Float

spine
setScaleX(scaleX: Float): Void
Name Type
scaleX Float

spine
getScaleY(): Float

Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale inheritance.

Returns
Float

spine
setScaleY(scaleY: Float): Void
Name Type
scaleY Float

spine
setScale(scaleX: Float, scaleY: Float): Void
Name Type
scaleX Float
scaleY Float

spine
getX(): Float

Sets the skeleton X position, which is added to the root bone worldX position.

Returns
Float

spine
setX(x: Float): Void
Name Type
x Float

spine
getY(): Float

Sets the skeleton Y position, which is added to the root bone worldY position.

Returns
Float

spine
setY(y: Float): Void
Name Type
y Float

spine
setPosition(x: Float, y: Float): Void

Sets the skeleton X and Y position, which is added to the root bone worldX and worldY position.

Name Type
x Float
y Float

spine
getTime(): Float

Returns the skeleton's time. This can be used for tracking, such as with Slot {@link Slot#getAttachmentTime()}.

See {@link #update(float)}. | Returns | |---------| | [Float](/api-docs/clay-native/Float/) |


spine
setTime(time: Float): Void
Name Type
time Float

spine
update(delta: Float): Void

Increments the skeleton's {@link #time}.

Name Type
delta Float

spine
toString(): String
Returns
String

spine
new(data: SkeletonData): Void
Name Type
data SkeletonData

Private Members

spine
sortIkConstraint(constraint: IkConstraint): Void
Name Type
constraint IkConstraint

spine
sortPathConstraint(constraint: PathConstraint): Void
Name Type
constraint PathConstraint

spine
sortTransformConstraint(constraint: TransformConstraint): Void
Name Type
constraint TransformConstraint

spine
sortPathConstraintAttachmentWithSkin(skin: Skin, slotIndex: Int, slotBone: Bone): Void
Name Type
skin Skin
slotIndex Int
slotBone Bone

spine
sortPathConstraintAttachment(attachment: spine.attachments.Attachment, slotBone: Bone): Void
Name Type
attachment spine.attachments.Attachment
slotBone Bone

spine
sortBone(bone: Bone): Void
Name Type
bone Bone

spine
sortReset(bones: spine.support.utils.Array<Bone>): Void
Name Type
bones spine.support.utils.Array<Bone>