API / Slot
Class: abstract
Slot
Defined in: armature/Slot.ts:167
The slot attached to the armature, controls the display status and properties of the display object. A bone can contain multiple slots. A slot can contain multiple display objects, displaying only one of the display objects at a time, but you can toggle the display object into frame animation while the animation is playing. The display object can be a normal texture, or it can be a display of a child armature, a grid display object, and a custom other display object.
Extends
Extended by
Constructors
Constructor
new Slot(): Slot;
Returns
Slot
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
_cachedFrameIndices
_cachedFrameIndices: number[];
Defined in: armature/Slot.ts:255
Internal
_colorDirty
_colorDirty: boolean;
Defined in: armature/Slot.ts:190
Internal
_colorTransform
readonly _colorTransform: ColorTransform;
Defined in: armature/Slot.ts:221
Internal
_displayFrame
_displayFrame: DisplayFrame;
Defined in: armature/Slot.ts:237
Internal
_displayFrames
readonly _displayFrames: DisplayFrame[] = [];
Defined in: armature/Slot.ts:225
Internal
_geometryBones
readonly _geometryBones: Bone[] = [];
Defined in: armature/Slot.ts:229
Internal
_geometryData
_geometryData: GeometryData;
Defined in: armature/Slot.ts:241
Internal
_globalAlpha
_globalAlpha: number;
Defined in: armature/TransformObject.ts:82
Internal
Inherited from
_pivotX
_pivotX: number;
Defined in: armature/Slot.ts:212
Internal
_pivotY
_pivotY: number;
Defined in: armature/Slot.ts:216
Internal
_slotData
_slotData: SlotData;
Defined in: armature/Slot.ts:233
Internal
_verticesDirty
_verticesDirty: boolean;
Defined in: armature/Slot.ts:194
Internal
_zIndex
_zIndex: number;
Defined in: armature/Slot.ts:208
Internal
_zOrder
_zOrder: number;
Defined in: armature/Slot.ts:204
Internal
displayController
displayController: string;
Defined in: armature/Slot.ts:179
Displays the animated state or mixed group name controlled by the object, set to null to be controlled by all animation states.
Default
null
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
Accessors
armature
Get Signature
get armature(): Armature;
Defined in: armature/TransformObject.ts:129
The armature to which it belongs.
Returns
Inherited from
boundingBoxData
Get Signature
get boundingBoxData(): BoundingBoxData;
Defined in: armature/Slot.ts:1156
The custom bounding box data for the slot at current time.
Returns
childArmature
Get Signature
get childArmature(): Armature;
Defined in: armature/Slot.ts:1215
The child armature that the slot displayed at current time.
Example
let slot = armature.getSlot("weapon");
let prevChildArmature = slot.childArmature;
if (prevChildArmature) {
prevChildArmature.dispose();
}
slot.childArmature = factory.buildArmature("weapon_blabla", "weapon_blabla_project");
Returns
Set Signature
set childArmature(value: Armature): void;
Defined in: armature/Slot.ts:1218
Parameters
Parameter | Type |
---|---|
value | Armature |
Returns
void
display
Get Signature
get display(): any;
Defined in: armature/Slot.ts:1183
The display object that the slot displays at this time.
Example
let slot = armature.getSlot("text");
slot.display = new yourEngine.TextField();
Returns
any
Set Signature
set display(value: any): void;
Defined in: armature/Slot.ts:1186
Parameters
Parameter | Type |
---|---|
value | any |
Returns
void
displayFrameCount
Set Signature
set displayFrameCount(value: number): void;
Defined in: armature/Slot.ts:1067
Parameters
Parameter | Type |
---|---|
value | number |
Returns
void
displayIndex
Get Signature
get displayIndex(): number;
Defined in: armature/Slot.ts:1098
The index of the display object displayed in the display list.
Example
let slot = armature.getSlot("weapon");
slot.displayIndex = 3;
slot.displayController = "none";
Returns
number
Set Signature
set displayIndex(value: number): void;
Defined in: armature/Slot.ts:1101
Parameters
Parameter | Type |
---|---|
value | number |
Returns
void
displayList
Get Signature
get displayList(): any[];
Defined in: armature/Slot.ts:1123
Contains a display list of display objects or child armatures.
Returns
any
[]
Set Signature
set displayList(value: any[]): void;
Defined in: armature/Slot.ts:1131
Parameters
Parameter | Type |
---|---|
value | any [] |
Returns
void
name
Get Signature
get name(): string;
Defined in: armature/Slot.ts:1113
The slot name.
Returns
string
parent
Get Signature
get parent(): Bone;
Defined in: armature/Slot.ts:1232
The parent bone to which it belongs.
Returns
slotData
Get Signature
get slotData(): SlotData;
Defined in: armature/Slot.ts:1146
The slot data.
Returns
visible
Get Signature
get visible(): boolean;
Defined in: armature/Slot.ts:1050
The visible of slot's display object.
Default
true
Returns
boolean
Set Signature
set visible(value: boolean): void;
Defined in: armature/Slot.ts:1053
Parameters
Parameter | Type |
---|---|
value | boolean |
Returns
void
Methods
_isBonesUpdate()
_isBonesUpdate(): boolean;
Defined in: armature/Slot.ts:358
Internal
Returns
boolean
_setColor()
_setColor(value: ColorTransform): boolean;
Defined in: armature/Slot.ts:627
Internal
Parameters
Parameter | Type |
---|---|
value | ColorTransform |
Returns
boolean
_setDisplayIndex()
_setDisplayIndex(value: number, isAnimation: boolean): void;
Defined in: armature/Slot.ts:594
Internal
Parameters
Parameter | Type | Default value |
---|---|---|
value | number | undefined |
isAnimation | boolean | false |
Returns
void
_setZOrder()
_setZOrder(value: number): boolean;
Defined in: armature/Slot.ts:614
Internal
Parameters
Parameter | Type |
---|---|
value | number |
Returns
boolean
_updateAlpha()
_updateAlpha(): void;
Defined in: armature/Slot.ts:370
Internal
Returns
void
_updateVisible()
abstract _updateVisible(): void;
Defined in: armature/Slot.ts:338
Internal
Returns
void
containsPoint()
containsPoint(x: number, y: number): boolean;
Defined in: armature/Slot.ts:933
Check whether a specific point is inside a custom bounding box in the 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
boolean
getDisplay()
getDisplay(): any;
Defined in: armature/Slot.ts:1243
Deprecated, please refer to #display.
Returns
any
Deprecated
init()
init(
slotData: SlotData,
armatureValue: Armature,
rawDisplay: any,
meshDisplay: any): void;
Defined in: armature/Slot.ts:635
Internal
Parameters
Parameter | Type |
---|---|
slotData | SlotData |
armatureValue | Armature |
rawDisplay | any |
meshDisplay | any |
Returns
void
intersectsSegment()
intersectsSegment(
xA: number,
yA: number,
xB: number,
yB: number,
intersectionPointA: object,
intersectionPointB: object,
normalRadians: object): number;
Defined in: armature/Slot.ts:981
Check whether a specific segment intersects a custom bounding box for the slot. 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
number
Intersection situation. [1: Disjoint and segments within the bounding box, 0: Disjoint, 1: Intersecting and having a nodal point and ending in the bounding box, 2: Intersecting and having a nodal point and starting at the bounding box, 3: Intersecting and having two intersections, N: Intersecting and having N intersections]
invalidUpdate()
invalidUpdate(): void;
Defined in: armature/Slot.ts:788
Forces the slot to update the state of the display object in the next frame.
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
setDisplay()
setDisplay(value: any): void;
Defined in: armature/Slot.ts:1253
Deprecated, please refer to #display.
Parameters
Parameter | Type |
---|---|
value | any |
Returns
void
Deprecated
update()
update(cacheFrameIndex: number): void;
Defined in: armature/Slot.ts:674
Internal
Parameters
Parameter | Type |
---|---|
cacheFrameIndex | number |
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: core/BaseObject.ts:56
Returns
string