API / Armature
Class: Armature
Defined in: armature/Armature.ts:44
Armature is the core of the skeleton animation system.
Extends
Implements
Constructors
Constructor
new Armature(): Armature;
Returns
Armature
Inherited from
Properties
_alphaDirty
_alphaDirty: boolean;
Defined in: armature/Armature.ts:80
Internal
_armatureData
_armatureData: ArmatureData;
Defined in: armature/Armature.ts:102
Internal
_cacheFrameIndex
_cacheFrameIndex: number;
Defined in: armature/Armature.ts:86
Internal
_constraints
readonly _constraints: Constraint[] = [];
Defined in: armature/Armature.ts:97
Internal
_dragonBones
_dragonBones: DragonBones;
Defined in: armature/Armature.ts:114
Internal
_globalAlpha
_globalAlpha: number;
Defined in: armature/Armature.ts:91
Internal
_lockUpdate
_lockUpdate: boolean;
Defined in: armature/Armature.ts:70
Internal
_parent
_parent: Slot;
Defined in: armature/Armature.ts:119
Internal
_replaceTextureAtlasData
_replaceTextureAtlasData: TextureAtlasData = null;
Defined in: armature/Armature.ts:109
Internal
_zIndexDirty
_zIndexDirty: boolean;
Defined in: armature/Armature.ts:76
Internal
hashCode
readonly hashCode: number;
Defined in: core/BaseObject.ts:156
A unique identification number assigned to the object.
Inherited from
inheritAnimation
inheritAnimation: boolean;
Defined in: armature/Armature.ts:62
stopped
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
true
Implementation of
Accessors
animation
Get Signature
get animation(): Animation;
Defined in: armature/Armature.ts:777
The animation player.
Returns
armatureData
Get Signature
get armatureData(): ArmatureData;
Defined in: armature/Armature.ts:766
The armature data.
Returns
cacheFrameRate
Get Signature
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
armature.cacheFrameRate = 24;
Returns
number
Set Signature
set cacheFrameRate(value: number): void;
Defined in: armature/Armature.ts:735
Parameters
Parameter | Type |
---|---|
value | number |
Returns
void
clock
Get Signature
get clock(): WorldClock;
Defined in: armature/Armature.ts:836
The Wordclock instance to which the current belongs.
Example
armature.clock = factory.clock; // Add armature to clock.
armature.clock = null; // Remove armature from clock.
Returns
Set Signature
set clock(value: WorldClock): void;
Defined in: armature/Armature.ts:839
The Wordclock instance to which the current belongs.
Examples
armature.clock = factory.clock; // Add armature to clock.
armature.clock = null; // Remove armature from clock.
armature.clock = factory.clock; // 将骨架添加到时钟。
armature.clock = null; // 将骨架从时钟移除。
Parameters
Parameter | Type |
---|---|
value | WorldClock |
Returns
void
The Wordclock instance to which the current belongs.
Example
armature.clock = factory.clock; // Add armature to clock.
armature.clock = null; // Remove armature from clock.
Implementation of
display
Get Signature
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
get eventDispatcher(): IEventDispatcher;
Defined in: armature/Armature.ts:793
The EventDispatcher instance of the armature.
Returns
flipX
Get Signature
get flipX(): boolean;
Defined in: armature/Armature.ts:684
Whether to flip the armature horizontally.
Returns
boolean
Set Signature
set flipX(value: boolean): void;
Defined in: armature/Armature.ts:687
Parameters
Parameter | Type |
---|---|
value | boolean |
Returns
void
flipY
Get Signature
get flipY(): boolean;
Defined in: armature/Armature.ts:702
Whether to flip the armature vertically.
Returns
boolean
Set Signature
set flipY(value: boolean): void;
Defined in: armature/Armature.ts:705
Parameters
Parameter | Type |
---|---|
value | boolean |
Returns
void
name
Get Signature
get name(): string;
Defined in: armature/Armature.ts:755
The armature name.
Returns
string
parent
Get Signature
get parent(): Slot;
Defined in: armature/Armature.ts:870
Get the parent slot which the armature belongs to.
Returns
proxy
Get Signature
get proxy(): IArmatureProxy;
Defined in: armature/Armature.ts:783
Pivate
Returns
replacedTexture
Set Signature
set replacedTexture(value: any): void;
Defined in: armature/Armature.ts:816
Parameters
Parameter | Type |
---|---|
value | any |
Returns
void
Methods
_addBone()
_addBone(value: Bone): void;
Defined in: armature/Armature.ts:210
Internal
Parameters
Parameter | Type |
---|---|
value | Bone |
Returns
void
_addConstraint()
_addConstraint(value: Constraint): void;
Defined in: armature/Armature.ts:226
Internal
Parameters
Parameter | Type |
---|---|
value | Constraint |
Returns
void
_addSlot()
_addSlot(value: Slot): void;
Defined in: armature/Armature.ts:218
Internal
Parameters
Parameter | Type |
---|---|
value | Slot |
Returns
void
_bufferAction()
_bufferAction(action: EventObject, append: boolean): void;
Defined in: armature/Armature.ts:234
Internal
Parameters
Parameter | Type |
---|---|
action | EventObject |
append | boolean |
Returns
void
_sortZOrder()
_sortZOrder(slotIndices: number[] | Int16Array<ArrayBuffer>, offset: number): void;
Defined in: armature/Armature.ts:184
Internal
Parameters
Parameter | Type |
---|---|
slotIndices | number [] | Int16Array <ArrayBuffer > |
offset | number |
Returns
void
advanceTime()
advanceTime(passedTime: number): void;
Defined in: armature/Armature.ts:286
Advance time.
Parameters
Parameter | Type | Description |
---|---|---|
passedTime | number | Passed time. (In seconds) |
Returns
void
Implementation of
containsPoint()
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
Parameter | Type | Description |
---|---|---|
x | number | The horizontal coordinate of the point. |
y | number | The vertical coordinate of the point. |
Returns
dispose()
dispose(): void;
Defined in: armature/Armature.ts:256
Dispose the armature. (Return to the object pool)
Returns
void
Example
removeChild(armature.display);
armature.dispose();
getBone()
getBone(name: string): Bone;
Defined in: armature/Armature.ts:588
Get a specific bone.
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The bone name. |
Returns
getBoneByDisplay()
getBoneByDisplay(display: any): Bone;
Defined in: armature/Armature.ts:608
Get a specific bone by the display.
Parameters
Parameter | Type | Description |
---|---|---|
display | any | The display object. |
Returns
getBones()
getBones(): Bone[];
Defined in: armature/Armature.ts:663
Get all bones.
Returns
Bone
[]
getDisplay()
getDisplay(): any;
Defined in: armature/Armature.ts:880
Deprecated, please refer to #display.
Returns
any
Deprecated
getSlot()
getSlot(name: string): Slot;
Defined in: armature/Armature.ts:624
Get a specific slot.
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The slot name. |
Returns
getSlotByDisplay()
getSlotByDisplay(display: any): Slot;
Defined in: armature/Armature.ts:644
Get a specific slot by the display.
Parameters
Parameter | Type | Description |
---|---|---|
display | any | The display object. |
Returns
getSlots()
getSlots(): Slot[];
Defined in: armature/Armature.ts:674
Get all slots.
Returns
Slot
[]
init()
init(
armatureData: ArmatureData,
proxy: IArmatureProxy,
display: any,
dragonBones: DragonBones): void;
Defined in: armature/Armature.ts:265
Internal
Parameters
Parameter | Type |
---|---|
armatureData | ArmatureData |
proxy | IArmatureProxy |
display | any |
dragonBones | DragonBones |
Returns
void
intersectsSegment()
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
Parameter | Type | Default value | Description |
---|---|---|---|
xA | number | undefined | The horizontal coordinate of the beginning of the segment. |
yA | number | undefined | The vertical coordinate of the beginning of the segment. |
xB | number | undefined | The horizontal coordinate of the end point of the segment. |
yB | number | undefined | The vertical coordinate of the end point of the segment. |
intersectionPointA | { x : number ; y : number ; } | null | The 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.x | number | undefined | - |
intersectionPointA.y | number | undefined | - |
intersectionPointB | { x : number ; y : number ; } | null | The 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.x | number | undefined | - |
intersectionPointB.y | number | undefined | - |
normalRadians | { x : number ; y : number ; } | null | The 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.x | number | undefined | - |
normalRadians.y | number | undefined | - |
Returns
The slot of the first custom bounding box where the segment intersects from the start point to the end point.
invalidUpdate()
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
Parameter | Type | Default value | Description |
---|---|---|---|
boneName | string | null | The bone name. (If not set, all bones will be update) |
updateSlot | boolean | false | Whether to update the bone's slots. (Default: false) |
Returns
void
returnToPool()
returnToPool(): void;
Defined in: core/BaseObject.ts:167
Clear the object and return it back to object pool。
Returns
void
Inherited from
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/Armature.ts:45
Returns
string