API / Bone
Class: Bone
Defined in: armature/Bone.ts:44
Bone is one of the most important logical units in the armature animation system, and is responsible for the realization of translate, rotation, scaling in the animations. A armature can contain multiple bones.
Extends
Extended by
Constructors
Constructor
new Bone(): Bone;
Returns
Bone
Inherited from
Properties
_alpha
_alpha: number;
Defined in: armature/TransformObject.ts:78
Internal
Inherited from
_armature
_armature: Armature;
Defined in: armature/TransformObject.ts:86
Internal
Inherited from
_boneData
_boneData: BoneData;
Defined in: armature/Bone.ts:79
Internal
_cachedFrameIndices
_cachedFrameIndices: number[];
Defined in: armature/Bone.ts:87
Internal
_childrenTransformDirty
_childrenTransformDirty: boolean;
Defined in: armature/Bone.ts:68
Internal
_globalAlpha
_globalAlpha: number;
Defined in: armature/TransformObject.ts:82
Internal
Inherited from
_hasConstraint
_hasConstraint: boolean;
Defined in: armature/Bone.ts:73
Internal
_transformDirty
_transformDirty: boolean;
Defined in: armature/Bone.ts:64
Internal
animationPose
readonly animationPose: Transform;
Defined in: armature/Bone.ts:60
Internal
global
readonly global: Transform;
Defined in: armature/TransformObject.ts:56
A transform relative to the armature coordinate system.
Inherited from
globalTransformMatrix
readonly globalTransformMatrix: Matrix;
Defined in: armature/TransformObject.ts:47
A matrix relative to the armature coordinate system.
Inherited from
TransformObject
.globalTransformMatrix
hashCode
readonly hashCode: number;
Defined in: core/BaseObject.ts:156
A unique identification number assigned to the object.
Inherited from
offset
readonly offset: Transform;
Defined in: armature/TransformObject.ts:65
The offset transform relative to the armature or the parent bone coordinate system.
Inherited from
offsetMode
offsetMode: OffsetMode;
Defined in: armature/Bone.ts:56
The offset mode.
Accessors
armature
Get Signature
get armature(): Armature;
Defined in: armature/TransformObject.ts:129
The armature to which it belongs.
Returns
Inherited from
boneData
Get Signature
get boneData(): BoneData;
Defined in: armature/Bone.ts:499
The bone data.
Returns
name
Get Signature
get name(): string;
Defined in: armature/Bone.ts:534
The bone name.
Returns
string
parent
Get Signature
get parent(): Bone;
Defined in: armature/Bone.ts:544
The parent bone to which it belongs.
Returns
Bone
visible
Get Signature
get visible(): boolean;
Defined in: armature/Bone.ts:511
The visible of all slots in the bone.
Default
true
Returns
boolean
Set Signature
set visible(value: boolean): void;
Defined in: armature/Bone.ts:514
Parameters
Parameter | Type |
---|---|
value | boolean |
Returns
void
Methods
_updateAlpha()
_updateAlpha(): void;
Defined in: armature/Bone.ts:331
Internal
Returns
void
contains()
contains(value: Bone): boolean;
Defined in: armature/Bone.ts:480
Check whether the bone contains a specific bone.
Parameters
Parameter | Type |
---|---|
value | Bone |
Returns
boolean
init()
init(boneData: BoneData, armatureValue: Armature): void;
Defined in: armature/Bone.ts:342
Internal
Parameters
Parameter | Type |
---|---|
boneData | BoneData |
armatureValue | Armature |
Returns
void
invalidUpdate()
invalidUpdate(): void;
Defined in: armature/Bone.ts:469
Forces the bone to update the transform in the next frame. When the bone is not animated or its animation state is finished, the bone will not continue to update, and when the skeleton must be updated for some reason, the method needs to be called explicitly.
Returns
void
Example
let bone = armature.getBone("arm");
bone.offset.scaleX = 2.0;
bone.invalidUpdate();
returnToPool()
returnToPool(): void;
Defined in: core/BaseObject.ts:167
Clear the object and return it back to object pool。
Returns
void
Inherited from
update()
update(cacheFrameIndex: number): void;
Defined in: armature/Bone.ts:362
Internal
Parameters
Parameter | Type |
---|---|
cacheFrameIndex | number |
Returns
void
updateByConstraint()
updateByConstraint(): void;
Defined in: armature/Bone.ts:442
Internal
Returns
void
updateGlobalTransform()
updateGlobalTransform(): void;
Defined in: armature/TransformObject.ts:116
For performance considerations, rotation or scale in the #global attribute of the bone or slot is not always properly accessible, some engines do not rely on these attributes to update rendering, such as Egret. The use of this method ensures that the access to the #global property is correctly rotation or scale.
Returns
void
Example
bone.updateGlobalTransform();
let rotation = bone.global.rotation;
Inherited from
TransformObject
.updateGlobalTransform
borrowObject()
static borrowObject<T>(objectConstructor: () => T): T;
Defined in: core/BaseObject.ts:136
Get an instance of the specify class from object pool.
Type Parameters
Type Parameter |
---|
T extends BaseObject |
Parameters
Parameter | Type | Description |
---|---|---|
objectConstructor | () => T | The specify class. |
Returns
T
Inherited from
clearPool()
static clearPool(objectConstructor: typeof BaseObject): void;
Defined in: core/BaseObject.ts:111
Clear the cached instances of a specify object pool.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
objectConstructor | typeof BaseObject | null | Specify class. (Clear all cached instances if not set) |
Returns
void
Inherited from
setMaxCount()
static setMaxCount(objectConstructor: typeof BaseObject, maxCount: number): void;
Defined in: core/BaseObject.ts:72
Set the maximum cache count of the specify object pool.
Parameters
Parameter | Type | Description |
---|---|---|
objectConstructor | typeof BaseObject | The specify class. (Set all object pools max cache count if not set) |
maxCount | number | Max count. |
Returns
void
Inherited from
toString()
static toString(): string;
Defined in: armature/Bone.ts:45
Returns
string