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.

Constructor

new(data:BoneData, skeleton:Skeleton, parent:Bone)

Variables

@:value(new Array())children:Array<Bone> = new Array()

@:value(0)x:Float = 0

@:value(0)y:Float = 0

@:value(0)rotation:Float = 0

@:value(0)scaleX:Float = 0

@:value(0)scaleY:Float = 0

@:value(0)shearX:Float = 0

@:value(0)shearY:Float = 0

@:value(0)ax:Float = 0

@:value(0)ay:Float = 0

@:value(0)arotation:Float = 0

@:value(0)ascaleX:Float = 0

@:value(0)ascaleY:Float = 0

@:value(0)ashearX:Float = 0

@:value(0)ashearY:Float = 0

@:value(0)a:Float = 0

@:value(0)b:Float = 0

@:value(0)worldX:Float = 0

@:value(0)c:Float = 0

@:value(0)d:Float = 0

@:value(0)worldY:Float = 0

@:value(false)sorted:Bool = false

@:value(false)active:Bool = false

Methods

update():Void

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

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)}.

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.

setToSetupPose():Void

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

getData():BoneData

The bone's setup pose data.

getSkeleton():Skeleton

The skeleton this bone belongs to.

getParent():Bone

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

getChildren():Array<Bone>

The immediate children of this bone.

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.

getX():Float

The local x translation.

getY():Float

The local y translation.

getRotation():Float

The local rotation in degrees, counter clockwise.

getScaleX():Float

The local scaleX.

getScaleY():Float

The local scaleY.

setScale(scaleX:Float, scaleY:Float):Void

getShearX():Float

The local shearX.

getShearY():Float

The local shearY.

getAX():Float

The applied local x translation.

getAY():Float

The applied local y translation.

getARotation():Float

The applied local rotation in degrees, counter clockwise.

getAScaleX():Float

The applied local scaleX.

getAScaleY():Float

The applied local scaleY.

getAShearX():Float

The applied local shearX.

getAShearY():Float

The applied local shearY.

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.

getA():Float

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

getB():Float

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

getC():Float

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

getD():Float

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

getWorldX():Float

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

getWorldY():Float

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

getWorldRotationX():Float

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

getWorldRotationY():Float

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

getWorldScaleX():Float

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

getWorldScaleY():Float

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

worldToLocal(world:Vector2):Vector2

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

localToWorld(local:Vector2):Vector2

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

worldToLocalRotation(worldRotation:Float):Float

Transforms a world rotation to a local rotation.

localToWorldRotation(localRotation:Float):Float

Transforms a local rotation to a world rotation.

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.