Skip to content

API / Armature

Class: Armature ​

Defined in: armature/Armature.ts:44

Armature is the core of the skeleton animation system.

Extends ​

Implements ​

Constructors ​

Constructor ​

ts
new Armature(): Armature;

Returns ​

Armature

Inherited from ​

BaseObject.constructor

Properties ​

_alphaDirty ​

ts
_alphaDirty: boolean;

Defined in: armature/Armature.ts:80

Internal


_armatureData ​

ts
_armatureData: ArmatureData;

Defined in: armature/Armature.ts:102

Internal


_cacheFrameIndex ​

ts
_cacheFrameIndex: number;

Defined in: armature/Armature.ts:86

Internal


_constraints ​

ts
readonly _constraints: Constraint[] = [];

Defined in: armature/Armature.ts:97

Internal


_dragonBones ​

ts
_dragonBones: DragonBones;

Defined in: armature/Armature.ts:114

Internal


_globalAlpha ​

ts
_globalAlpha: number;

Defined in: armature/Armature.ts:91

Internal


_lockUpdate ​

ts
_lockUpdate: boolean;

Defined in: armature/Armature.ts:70

Internal


_parent ​

ts
_parent: Slot;

Defined in: armature/Armature.ts:119

Internal


_replaceTextureAtlasData ​

ts
_replaceTextureAtlasData: TextureAtlasData = null;

Defined in: armature/Armature.ts:109

Internal


_zIndexDirty ​

ts
_zIndexDirty: boolean;

Defined in: armature/Armature.ts:76

Internal


hashCode ​

ts
readonly hashCode: number;

Defined in: core/BaseObject.ts:156

A unique identification number assigned to the object.

Inherited from ​

BaseObject.hashCode


inheritAnimation ​

ts
inheritAnimation: boolean;

Defined in: armature/Armature.ts:62


stopped ​

ts
stopped: boolean = false;

Defined in: armature/Armature.ts:61

Whether to inherit the animation control of the parent armature. True to try to have the child armature play an animation with the same name when the parent armature play the animation.

Default ​

ts
true

Implementation of ​

IAnimatable.stopped

Accessors ​

animation ​

Get Signature ​

ts
get animation(): Animation;

Defined in: armature/Armature.ts:777

The animation player.

Returns ​

Animation


armatureData ​

Get Signature ​

ts
get armatureData(): ArmatureData;

Defined in: armature/Armature.ts:766

The armature data.

Returns ​

ArmatureData


cacheFrameRate ​

Get Signature ​

ts
get cacheFrameRate(): number;

Defined in: armature/Armature.ts:732

The animation cache frame rate, which turns on the animation cache when the set value is greater than 0. There is a certain amount of memory overhead to improve performance by caching animation data in memory. The frame rate should not be set too high, usually with the frame rate of the animation is similar and lower than the program running frame rate. When the animation cache is turned on, some features will fail, such as the offset property of bone.

Example ​
ts
    armature.cacheFrameRate = 24;
Returns ​

number

Set Signature ​

ts
set cacheFrameRate(value: number): void;

Defined in: armature/Armature.ts:735

Parameters ​
ParameterType
valuenumber
Returns ​

void


clock ​

Get Signature ​

ts
get clock(): WorldClock;

Defined in: armature/Armature.ts:836

The Wordclock instance to which the current belongs.

Example ​
ts
    armature.clock = factory.clock; // Add armature to clock.
    armature.clock = null; // Remove armature from clock.
Returns ​

WorldClock

Set Signature ​

ts
set clock(value: WorldClock): void;

Defined in: armature/Armature.ts:839

The Wordclock instance to which the current belongs.

Examples ​
ts
    armature.clock = factory.clock; // Add armature to clock.
    armature.clock = null; // Remove armature from clock.
ts
    armature.clock = factory.clock; // 将骨架添加到时钟。
    armature.clock = null; // 将骨架从时钟移除。
Parameters ​
ParameterType
valueWorldClock
Returns ​

void

The Wordclock instance to which the current belongs.

Example ​

ts
    armature.clock = factory.clock; // Add armature to clock.
    armature.clock = null; // Remove armature from clock.

Implementation of ​

IAnimatable.clock


display ​

Get Signature ​

ts
get display(): any;

Defined in: armature/Armature.ts:807

The display container. The display of the slot is displayed as the parent. Depending on the rendering engine, the type will be different, usually the DisplayObjectContainer type.

Returns ​

any


eventDispatcher ​

Get Signature ​

ts
get eventDispatcher(): IEventDispatcher;

Defined in: armature/Armature.ts:793

The EventDispatcher instance of the armature.

Returns ​

IEventDispatcher


flipX ​

Get Signature ​

ts
get flipX(): boolean;

Defined in: armature/Armature.ts:684

Whether to flip the armature horizontally.

Returns ​

boolean

Set Signature ​

ts
set flipX(value: boolean): void;

Defined in: armature/Armature.ts:687

Parameters ​
ParameterType
valueboolean
Returns ​

void


flipY ​

Get Signature ​

ts
get flipY(): boolean;

Defined in: armature/Armature.ts:702

Whether to flip the armature vertically.

Returns ​

boolean

Set Signature ​

ts
set flipY(value: boolean): void;

Defined in: armature/Armature.ts:705

Parameters ​
ParameterType
valueboolean
Returns ​

void


name ​

Get Signature ​

ts
get name(): string;

Defined in: armature/Armature.ts:755

The armature name.

Returns ​

string


parent ​

Get Signature ​

ts
get parent(): Slot;

Defined in: armature/Armature.ts:870

Get the parent slot which the armature belongs to.

Returns ​

Slot


proxy ​

Get Signature ​

ts
get proxy(): IArmatureProxy;

Defined in: armature/Armature.ts:783

Pivate ​
Returns ​

IArmatureProxy


replacedTexture ​

Set Signature ​

ts
set replacedTexture(value: any): void;

Defined in: armature/Armature.ts:816

Parameters ​
ParameterType
valueany
Returns ​

void

Methods ​

_addBone() ​

ts
_addBone(value: Bone): void;

Defined in: armature/Armature.ts:210

Internal

Parameters ​

ParameterType
valueBone

Returns ​

void


_addConstraint() ​

ts
_addConstraint(value: Constraint): void;

Defined in: armature/Armature.ts:226

Internal

Parameters ​

ParameterType
valueConstraint

Returns ​

void


_addSlot() ​

ts
_addSlot(value: Slot): void;

Defined in: armature/Armature.ts:218

Internal

Parameters ​

ParameterType
valueSlot

Returns ​

void


_bufferAction() ​

ts
_bufferAction(action: EventObject, append: boolean): void;

Defined in: armature/Armature.ts:234

Internal

Parameters ​

ParameterType
actionEventObject
appendboolean

Returns ​

void


_sortZOrder() ​

ts
_sortZOrder(slotIndices: number[] | Int16Array<ArrayBuffer>, offset: number): void;

Defined in: armature/Armature.ts:184

Internal

Parameters ​

ParameterType
slotIndicesnumber[] | Int16Array<ArrayBuffer>
offsetnumber

Returns ​

void


advanceTime() ​

ts
advanceTime(passedTime: number): void;

Defined in: armature/Armature.ts:286

Advance time.

Parameters ​

ParameterTypeDescription
passedTimenumberPassed time. (In seconds)

Returns ​

void

Implementation of ​

IAnimatable.advanceTime


containsPoint() ​

ts
containsPoint(x: number, y: number): Slot;

Defined in: armature/Armature.ts:448

Check whether a specific point is inside a custom bounding box in a slot. The coordinate system of the point is the inner coordinate system of the armature. Custom bounding boxes need to be customized in Dragonbones Pro.

Parameters ​

ParameterTypeDescription
xnumberThe horizontal coordinate of the point.
ynumberThe vertical coordinate of the point.

Returns ​

Slot


dispose() ​

ts
dispose(): void;

Defined in: armature/Armature.ts:256

Dispose the armature. (Return to the object pool)

Returns ​

void

Example ​

ts
    removeChild(armature.display);
    armature.dispose();

getBone() ​

ts
getBone(name: string): Bone;

Defined in: armature/Armature.ts:588

Get a specific bone.

Parameters ​

ParameterTypeDescription
namestringThe bone name.

Returns ​

Bone


getBoneByDisplay() ​

ts
getBoneByDisplay(display: any): Bone;

Defined in: armature/Armature.ts:608

Get a specific bone by the display.

Parameters ​

ParameterTypeDescription
displayanyThe display object.

Returns ​

Bone


getBones() ​

ts
getBones(): Bone[];

Defined in: armature/Armature.ts:663

Get all bones.

Returns ​

Bone[]


getDisplay() ​

ts
getDisplay(): any;

Defined in: armature/Armature.ts:880

Deprecated, please refer to #display.

Returns ​

any

Deprecated ​


getSlot() ​

ts
getSlot(name: string): Slot;

Defined in: armature/Armature.ts:624

Get a specific slot.

Parameters ​

ParameterTypeDescription
namestringThe slot name.

Returns ​

Slot


getSlotByDisplay() ​

ts
getSlotByDisplay(display: any): Slot;

Defined in: armature/Armature.ts:644

Get a specific slot by the display.

Parameters ​

ParameterTypeDescription
displayanyThe display object.

Returns ​

Slot


getSlots() ​

ts
getSlots(): Slot[];

Defined in: armature/Armature.ts:674

Get all slots.

Returns ​

Slot[]


init() ​

ts
init(
   armatureData: ArmatureData, 
   proxy: IArmatureProxy, 
   display: any, 
   dragonBones: DragonBones): void;

Defined in: armature/Armature.ts:265

Internal

Parameters ​

ParameterType
armatureDataArmatureData
proxyIArmatureProxy
displayany
dragonBonesDragonBones

Returns ​

void


intersectsSegment() ​

ts
intersectsSegment(
   xA: number, 
   yA: number, 
   xB: number, 
   yB: number, 
   intersectionPointA: object, 
   intersectionPointB: object, 
   normalRadians: object): Slot;

Defined in: armature/Armature.ts:492

Check whether a specific segment intersects a custom bounding box for a slot in the armature. The coordinate system of the segment and intersection is the inner coordinate system of the armature. Custom bounding boxes need to be customized in Dragonbones Pro.

Parameters ​

ParameterTypeDefault valueDescription
xAnumberundefinedThe horizontal coordinate of the beginning of the segment.
yAnumberundefinedThe vertical coordinate of the beginning of the segment.
xBnumberundefinedThe horizontal coordinate of the end point of the segment.
yBnumberundefinedThe vertical coordinate of the end point of the segment.
intersectionPointA{ x: number; y: number; }nullThe first intersection at which a line segment intersects the bounding box from the beginning to the end. (If not set, the intersection point will not calculated)
intersectionPointA.xnumberundefined-
intersectionPointA.ynumberundefined-
intersectionPointB{ x: number; y: number; }nullThe first intersection at which a line segment intersects the bounding box from the end to the beginning. (If not set, the intersection point will not calculated)
intersectionPointB.xnumberundefined-
intersectionPointB.ynumberundefined-
normalRadians{ x: number; y: number; }nullThe normal radians of the tangent of the intersection boundary box. [x: Normal radian of the first intersection tangent, y: Normal radian of the second intersection tangent] (If not set, the normal will not calculated)
normalRadians.xnumberundefined-
normalRadians.ynumberundefined-

Returns ​

Slot

The slot of the first custom bounding box where the segment intersects from the start point to the end point.


invalidUpdate() ​

ts
invalidUpdate(boneName: string, updateSlot: boolean): void;

Defined in: armature/Armature.ts:404

Forces a specific bone or its owning slot to update the transform or display property in the next frame.

Parameters ​

ParameterTypeDefault valueDescription
boneNamestringnullThe bone name. (If not set, all bones will be update)
updateSlotbooleanfalseWhether to update the bone's slots. (Default: false)

Returns ​

void


returnToPool() ​

ts
returnToPool(): void;

Defined in: core/BaseObject.ts:167

Clear the object and return it back to object pool。

Returns ​

void

Inherited from ​

BaseObject.returnToPool


borrowObject() ​

ts
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 ​

ParameterTypeDescription
objectConstructor() => TThe specify class.

Returns ​

T

Inherited from ​

BaseObject.borrowObject


clearPool() ​

ts
static clearPool(objectConstructor: typeof BaseObject): void;

Defined in: core/BaseObject.ts:111

Clear the cached instances of a specify object pool.

Parameters ​

ParameterTypeDefault valueDescription
objectConstructortypeof BaseObjectnullSpecify class. (Clear all cached instances if not set)

Returns ​

void

Inherited from ​

BaseObject.clearPool


setMaxCount() ​

ts
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 ​

ParameterTypeDescription
objectConstructortypeof BaseObjectThe specify class. (Set all object pools max cache count if not set)
maxCountnumberMax count.

Returns ​

void

Inherited from ​

BaseObject.setMaxCount


toString() ​

ts
static toString(): string;

Defined in: armature/Armature.ts:45

Returns ​

string

Overrides ​

BaseObject.toString

Released under the MIT License.