Skip to content

API / Surface

Class: Surface

Defined in: armature/Surface.ts:33

Internal

Extends

Constructors

Constructor

ts
new Surface(): Surface;

Returns

Surface

Inherited from

Bone.constructor

Properties

_alpha

ts
_alpha: number;

Defined in: armature/TransformObject.ts:78

Internal

Inherited from

Bone._alpha


_armature

ts
_armature: Armature;

Defined in: armature/TransformObject.ts:86

Internal

Inherited from

Bone._armature


_bone

ts
_bone: Bone;

Defined in: armature/Surface.ts:55


_boneData

ts
_boneData: BoneData;

Defined in: armature/Bone.ts:79

Internal

Inherited from

Bone._boneData


_cachedFrameIndices

ts
_cachedFrameIndices: number[];

Defined in: armature/Bone.ts:87

Internal

Inherited from

Bone._cachedFrameIndices


_childrenTransformDirty

ts
_childrenTransformDirty: boolean;

Defined in: armature/Bone.ts:68

Internal

Inherited from

Bone._childrenTransformDirty


_deformVertices

ts
readonly _deformVertices: number[] = [];

Defined in: armature/Surface.ts:45


_globalAlpha

ts
_globalAlpha: number;

Defined in: armature/TransformObject.ts:82

Internal

Inherited from

Bone._globalAlpha


_hasConstraint

ts
_hasConstraint: boolean;

Defined in: armature/Bone.ts:73

Internal

Inherited from

Bone._hasConstraint


_transformDirty

ts
_transformDirty: boolean;

Defined in: armature/Bone.ts:64

Internal

Inherited from

Bone._transformDirty


_vertices

ts
readonly _vertices: number[] = [];

Defined in: armature/Surface.ts:44


animationPose

ts
readonly animationPose: Transform;

Defined in: armature/Bone.ts:60

Internal

Inherited from

Bone.animationPose


global

ts
readonly global: Transform;

Defined in: armature/TransformObject.ts:56

A transform relative to the armature coordinate system.

Inherited from

Bone.global


globalTransformMatrix

ts
readonly globalTransformMatrix: Matrix;

Defined in: armature/TransformObject.ts:47

A matrix relative to the armature coordinate system.

Inherited from

Bone.globalTransformMatrix


hashCode

ts
readonly hashCode: number;

Defined in: core/BaseObject.ts:156

A unique identification number assigned to the object.

Inherited from

Bone.hashCode


offset

ts
readonly offset: Transform;

Defined in: armature/TransformObject.ts:65

The offset transform relative to the armature or the parent bone coordinate system.

Inherited from

Bone.offset


offsetMode

ts
offsetMode: OffsetMode;

Defined in: armature/Bone.ts:56

The offset mode.

Inherited from

Bone.offsetMode

Accessors

armature

Get Signature

ts
get armature(): Armature;

Defined in: armature/TransformObject.ts:129

The armature to which it belongs.

Returns

Armature

Inherited from

Bone.armature


boneData

Get Signature

ts
get boneData(): BoneData;

Defined in: armature/Bone.ts:499

The bone data.

Returns

BoneData

Inherited from

Bone.boneData


name

Get Signature

ts
get name(): string;

Defined in: armature/Bone.ts:534

The bone name.

Returns

string

Inherited from

Bone.name


parent

Get Signature

ts
get parent(): Bone;

Defined in: armature/Bone.ts:544

The parent bone to which it belongs.

Returns

Bone

Inherited from

Bone.parent


visible

Get Signature

ts
get visible(): boolean;

Defined in: armature/Bone.ts:511

The visible of all slots in the bone.

Default
ts
true
Returns

boolean

Set Signature

ts
set visible(value: boolean): void;

Defined in: armature/Bone.ts:514

Parameters
ParameterType
valueboolean
Returns

void

Inherited from

Bone.visible

Methods

_getGlobalTransformMatrix()

ts
_getGlobalTransformMatrix(x: number, y: number): Matrix;

Defined in: armature/Surface.ts:171

Parameters

ParameterType
xnumber
ynumber

Returns

Matrix


_updateAlpha()

ts
_updateAlpha(): void;

Defined in: armature/Bone.ts:331

Internal

Returns

void

Inherited from

Bone._updateAlpha


contains()

ts
contains(value: Bone): boolean;

Defined in: armature/Bone.ts:480

Check whether the bone contains a specific bone.

Parameters

ParameterType
valueBone

Returns

boolean

Inherited from

Bone.contains


invalidUpdate()

ts
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

ts
    let bone = armature.getBone("arm");
    bone.offset.scaleX = 2.0;
    bone.invalidUpdate();

Inherited from

Bone.invalidUpdate


returnToPool()

ts
returnToPool(): void;

Defined in: core/BaseObject.ts:167

Clear the object and return it back to object pool。

Returns

void

Inherited from

Bone.returnToPool


update()

ts
update(cacheFrameIndex: number): void;

Defined in: armature/Surface.ts:487

Internal

Parameters

ParameterType
cacheFrameIndexnumber

Returns

void

Overrides

Bone.update


updateByConstraint()

ts
updateByConstraint(): void;

Defined in: armature/Bone.ts:442

Internal

Returns

void

Inherited from

Bone.updateByConstraint


updateGlobalTransform()

ts
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

ts
    bone.updateGlobalTransform();
    let rotation = bone.global.rotation;

Inherited from

Bone.updateGlobalTransform


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

Bone.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

Bone.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

Bone.setMaxCount


toString()

ts
static toString(): string;

Defined in: armature/Surface.ts:34

Returns

string

Overrides

Bone.toString

Released under the MIT License.