Bone

spine.Bone (Class)
Implements: Updatable

Stores a bone's current pose.

A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a local transform that can be applied to compute the world transform. The local transform and applied transform may differ if a constraint or application code modifies the world transform after it was computed from the local transform.

Instance Members

spine
data: BoneData

spine
skeleton: Skeleton

spine
parent: Bone


spine
x: Float

spine
y: Float

spine
rotation: Float

spine
scaleX: Float

spine
scaleY: Float

spine
shearX: Float

spine
shearY: Float

spine
ax: Float

spine
ay: Float

spine
arotation: Float

spine
ascaleX: Float

spine
ascaleY: Float

spine
ashearX: Float

spine
ashearY: Float

spine
a: Float

spine
b: Float

spine
worldX: Float

spine
c: Float

spine
d: Float

spine
worldY: Float

spine
sorted: Bool

spine
active: Bool

spine
update(): Void

Computes the world transform using the parent bone and this bone's local applied transform.


spine
updateWorldTransform(): Void

Computes the world transform using the parent bone and this bone's local transform.

See {@link #updateWorldTransformWithData(float, float, float, float, float, float, float)}.


spine
updateWorldTransformWithData(x: Float, y: Float, rotation: Float, scaleX: Float, scaleY: Float, shearX: Float, shearY: Float): Void

Computes the world transform using the parent bone and the specified local transform. The applied transform is set to the specified local transform. Child bones are not updated.

See World transforms in the Spine Runtimes Guide.

Name Type
x Float
y Float
rotation Float
scaleX Float
scaleY Float
shearX Float
shearY Float

spine
setToSetupPose(): Void

Sets this bone's local transform to the setup pose.


spine
getData(): BoneData

The bone's setup pose data.

Returns
BoneData

spine
getSkeleton(): Skeleton

The skeleton this bone belongs to.

Returns
Skeleton

spine
getParent(): Bone

The parent bone, or null if this is the root bone.

Returns
Bone

spine
getChildren(): spine.support.utils.Array<Bone>

The immediate children of this bone.

Returns
spine.support.utils.Array<Bone>

spine
isActive(): Bool

Returns false when the bone has not been computed because {@link BoneData#getSkinRequired()} is true and the {@link Skeleton#getSkin() active skin} does not {@link Skin#getBones() contain} this bone.

Returns
Bool

spine
getX(): Float

The local x translation.

Returns
Float

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

spine
getY(): Float

The local y translation.

Returns
Float

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

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

spine
getRotation(): Float

The local rotation in degrees, counter clockwise.

Returns
Float

spine
setRotation(rotation: Float): Void
Name Type
rotation Float

spine
getScaleX(): Float

The local scaleX.

Returns
Float

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

spine
getScaleY(): Float

The local scaleY.

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
setScale2(scale: Float): Void
Name Type
scale Float

spine
getShearX(): Float

The local shearX.

Returns
Float

spine
setShearX(shearX: Float): Void
Name Type
shearX Float

spine
getShearY(): Float

The local shearY.

Returns
Float

spine
setShearY(shearY: Float): Void
Name Type
shearY Float

spine
getAX(): Float

The applied local x translation.

Returns
Float

spine
setAX(ax: Float): Void
Name Type
ax Float

spine
getAY(): Float

The applied local y translation.

Returns
Float

spine
setAY(ay: Float): Void
Name Type
ay Float

spine
getARotation(): Float

The applied local rotation in degrees, counter clockwise.

Returns
Float

spine
setARotation(arotation: Float): Void
Name Type
arotation Float

spine
getAScaleX(): Float

The applied local scaleX.

Returns
Float

spine
setAScaleX(ascaleX: Float): Void
Name Type
ascaleX Float

spine
getAScaleY(): Float

The applied local scaleY.

Returns
Float

spine
setAScaleY(ascaleY: Float): Void
Name Type
ascaleY Float

spine
getAShearX(): Float

The applied local shearX.

Returns
Float

spine
setAShearX(ashearX: Float): Void
Name Type
ashearX Float

spine
getAShearY(): Float

The applied local shearY.

Returns
Float

spine
setAShearY(ashearY: Float): Void
Name Type
ashearY Float

spine
updateAppliedTransform(): Void

Computes the applied transform values from the world transform.

If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply another constraint).

Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after calling this method is equivalent to the local transform used to compute the world transform, but may not be identical.


spine
getA(): Float

Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called.

Returns
Float

spine
setA(a: Float): Void
Name Type
a Float

spine
getB(): Float

Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called.

Returns
Float

spine
setB(b: Float): Void
Name Type
b Float

spine
getC(): Float

Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called.

Returns
Float

spine
setC(c: Float): Void
Name Type
c Float

spine
getD(): Float

Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called.

Returns
Float

spine
setD(d: Float): Void
Name Type
d Float

spine
getWorldX(): Float

The world X position. If changed, {@link #updateAppliedTransform()} should be called.

Returns
Float

spine
setWorldX(worldX: Float): Void
Name Type
worldX Float

spine
getWorldY(): Float

The world Y position. If changed, {@link #updateAppliedTransform()} should be called.

Returns
Float

spine
setWorldY(worldY: Float): Void
Name Type
worldY Float

spine
getWorldRotationX(): Float

The world rotation for the X axis, calculated using {@link #a} and {@link #c}.

Returns
Float

spine
getWorldRotationY(): Float

The world rotation for the Y axis, calculated using {@link #b} and {@link #d}.

Returns
Float

spine
getWorldScaleX(): Float

The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}.

Returns
Float

spine
getWorldScaleY(): Float

The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}.

Returns
Float

spine
getWorldTransform(worldTransform: spine.support.math.Matrix3): spine.support.math.Matrix3
Name Type
worldTransform spine.support.math.Matrix3
Returns
spine.support.math.Matrix3

Transforms a point from world coordinates to the bone's local coordinates.

Name Type
world spine.support.math.Vector2
Returns
spine.support.math.Vector2

Transforms a point from the bone's local coordinates to world coordinates.

Name Type
local spine.support.math.Vector2
Returns
spine.support.math.Vector2

spine
worldToLocalRotation(worldRotation: Float): Float

Transforms a world rotation to a local rotation.

Name Type
worldRotation Float
Returns
Float

spine
localToWorldRotation(localRotation: Float): Float

Transforms a local rotation to a world rotation.

Name Type
localRotation Float
Returns
Float

spine
rotateWorld(degrees: Float): Void

Rotates the world transform the specified amount.

After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and {@link #update()} will need to be called on any child bones, recursively.

Name Type
degrees Float

spine
toString(): String
Returns
String

spine
new(data: BoneData, skeleton: Skeleton, parent: Bone): Void
Name Type
data BoneData
skeleton Skeleton
parent Bone