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:Null<Bone>)

Variables

@:value(0.0)a:Float = 0.0

Part of the world transform matrix for the X axis. If changed, appliedValid should be set to false.

@:value(false)@:allow(spine.Skeleton)read onlyactive:Bool = false

Returns false when the bone has not been computed because BoneData.skinRequired is true and the active Skeleton.skin skin does not contain this bone in Skin.bones.

@:value(false)appliedValid:Bool = false

If true, the applied transform matches the world transform. If false, the world transform has been modified since it was computed and updateAppliedTransform must be called before accessing the applied transform.

@:value(0.0)arotation:Float = 0.0

The applied local rotation in degrees, counter clockwise.

@:value(0.0)ascaleX:Float = 0.0

The applied local scaleX.

@:value(0.0)ascaleY:Float = 0.0

The applied local scaleY.

@:value(0.0)ashearX:Float = 0.0

The applied local shearX.

@:value(0.0)ashearY:Float = 0.0

The applied local shearY.

@:value(0.0)ax:Float = 0.0

The applied local x translation.

@:value(0.0)ay:Float = 0.0

The applied local y translation.

@:value(0.0)b:Float = 0.0

Part of the world transform matrix for the Y axis. If changed, appliedValid should be set to false.

@:value(0.0)c:Float = 0.0

Part of the world transform matrix for the X axis. If changed, appliedValid should be set to false.

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

The immediate children of this bone.

@:value(0.0)d:Float = 0.0

Part of the world transform matrix for the Y axis. If changed, appliedValid should be set to false.

finaldata:BoneData

The bone's setup pose data.

finalparent:Null<Bone>

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

@:value(0.0)rotation:Float = 0.0

The local rotation in degrees, counter clockwise.

@:value(0.0)scaleX:Float = 0.0

The local scaleX.

@:value(0.0)scaleY:Float = 0.0

The local scaleY.

@:value(0.0)shearX:Float = 0.0

The local shearX.

@:value(0.0)shearY:Float = 0.0

The local shearY.

finalskeleton:Skeleton

The skeleton this bone belongs to.

@:value(0.0)worldX:Float = 0.0

The world Y position. If changed, appliedValid should be set to false.

@:value(0.0)worldY:Float = 0.0

The world X position. If changed, appliedValid should be set to false.

@:value(0.0)x:Float = 0.0

The local x translation.

@:value(0.0)y:Float = 0.0

The local y translation.

Methods

getWorldRotationX():Float

The world rotation for the X axis, calculated using a and `c.

getWorldRotationY():Float

The world rotation for the Y axis, calculated using b and `d.

getWorldScaleX():Float

The magnitude (always positive) of the world scale X, calculated using a and c.

getWorldScaleY():Float

The magnitude (always positive) of the world scale Y, calculated using b and d.

inlineisActive():Bool

Returns false when the bone has not been computed because BoneData.skinRequired is true and the active Skeleton.skin skin does not contain this bone in Skin.bones.

localToWorld(local:Vector2):Vector2

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

localToWorldRotation(localRotation:Float):Float

Transforms a local rotation to a world rotation.

rotateWorld(degrees:Float):Void

Rotates the world transform the specified amount and sets appliedValid to false. updateWorldTransform will need to be called on any child bones, recursively, and any constraints reapplied.

setToSetupPose():Void

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

inlineupdate():Void

Same as updateWorldTransform. This method exists for Bone to implement Updatable.

updateAppliedTransform():Void

Computes the applied transform values from the world transform. This allows the applied transform to be accessed after the world transform has been modified (by a constraint, rotateWorld, etc).

If updateWorldTransform has been called for a bone and appliedValid is false, then updateAppliedTransform must be called before accessing the applied transform.

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 tranform used to compute the world transform, but may not be identical.

updateWorldTransform():Void

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

See updateWorldTransformWith.

updateWorldTransformWith(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. Child bones are not updated.

See World transforms in the Spine Runtimes Guide.

worldToLocal(world:Vector2):Vector2

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

worldToLocalRotation(worldRotation:Float):Float

Transforms a world rotation to a local rotation.