Skip to content

API / AnimationState

Class: AnimationState ​

Defined in: animation/AnimationState.ts:40

The animation state is generated when the animation data is played.

Extends ​

Constructors ​

Constructor ​

ts
new AnimationState(): AnimationState;

Returns ​

AnimationState

Inherited from ​

BaseObject.constructor

Properties ​

_actionTimeline ​

ts
_actionTimeline: ActionTimelineState;

Defined in: animation/AnimationState.ts:213

Internal


_duration ​

ts
_duration: number;

Defined in: animation/AnimationState.ts:188

Internal


_fadeProgress ​

ts
_fadeProgress: number;

Defined in: animation/AnimationState.ts:195

Internal


_fadeState ​

ts
_fadeState: number;

Defined in: animation/AnimationState.ts:175

Internal

-1: Fade in, 0: Fade complete, 1: Fade out;


_parent ​

ts
_parent: AnimationState;

Defined in: animation/AnimationState.ts:220

Internal


_playheadState ​

ts
_playheadState: number;

Defined in: animation/AnimationState.ts:170

Internal

  • xx: Play Enabled, Fade Play Enabled

_position ​

ts
_position: number;

Defined in: animation/AnimationState.ts:184

Internal


_subFadeState ​

ts
_subFadeState: number;

Defined in: animation/AnimationState.ts:180

Internal

-1: Fade start, 0: Fading, 1: Fade complete;


_weightResult ​

ts
_weightResult: number;

Defined in: animation/AnimationState.ts:199

Internal


autoFadeOutTime ​

ts
autoFadeOutTime: number;

Defined in: animation/AnimationState.ts:140

The auto fade out time when the animation state play completed. [-1: Do not fade out automatically, [0~N]: The fade out time] (In seconds)

Default ​

ts
-1.0

displayControl ​

ts
displayControl: boolean;

Defined in: animation/AnimationState.ts:64

Whether the animation state has control over the display object properties of the slots. Sometimes blend a animation state does not want it to control the display object properties of the slots, especially if other animation state are controlling the display object properties of the slots.

Default ​

ts
true

group ​

ts
readonly group: string;

Defined in: animation/AnimationState.ts:164

The blend group name of the animation state. This property is typically used to specify the substitution of multiple animation states blend.


hashCode ​

ts
readonly hashCode: number;

Defined in: core/BaseObject.ts:156

A unique identification number assigned to the object.

Inherited from ​

BaseObject.hashCode


layer ​

ts
readonly layer: number;

Defined in: animation/AnimationState.ts:100

The blend layer. High layer animation state will get the blend weight first. When the blend weight is assigned more than 1, the remaining animation states will no longer get the weight assigned.


name ​

ts
readonly name: string;

Defined in: animation/AnimationState.ts:153

The name of the animation state. (Can be different from the name of the animation data)


playTimes ​

ts
playTimes: number;

Defined in: animation/AnimationState.ts:87

The play times. [0: Loop play, [1~N]: Play N times]


resetToPose ​

ts
resetToPose: boolean;

Defined in: animation/AnimationState.ts:75

Whether to reset the objects without animation to the armature pose when the animation state is start to play. This property should usually be set to false when blend multiple animation states.

Default ​

ts
true

timeScale ​

ts
timeScale: number;

Defined in: animation/AnimationState.ts:113

The play speed. The value is an overlay relationship with Animation#timeScale. [(-N~0): Reverse play, 0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]

Default ​

ts
1.0

Accessors ​

animationData ​

Get Signature ​

ts
get animationData(): AnimationData;

Defined in: animation/AnimationState.ts:1446

The animation data.

Returns ​

AnimationData


currentPlayTimes ​

Get Signature ​

ts
get currentPlayTimes(): number;

Defined in: animation/AnimationState.ts:1350

The times has been played.

Returns ​

number


currentTime ​

Get Signature ​

ts
get currentTime(): number;

Defined in: animation/AnimationState.ts:1370

The time is currently playing. (In seconds)

Returns ​

number

Set Signature ​

ts
set currentTime(value: number): void;

Defined in: animation/AnimationState.ts:1373

Parameters ​
ParameterType
valuenumber
Returns ​

void


isCompleted ​

Get Signature ​

ts
get isCompleted(): boolean;

Defined in: animation/AnimationState.ts:1340

Whether the animation state is play completed.

Returns ​

boolean


isFadeComplete ​

Get Signature ​

ts
get isFadeComplete(): boolean;

Defined in: animation/AnimationState.ts:1320

Whether the animation state is fade completed.

Returns ​

boolean


isFadeIn ​

Get Signature ​

ts
get isFadeIn(): boolean;

Defined in: animation/AnimationState.ts:1300

Whether the animation state is fading in.

Returns ​

boolean


isFadeOut ​

Get Signature ​

ts
get isFadeOut(): boolean;

Defined in: animation/AnimationState.ts:1310

Whether the animation state is fading out.

Returns ​

boolean


isPlaying ​

Get Signature ​

ts
get isPlaying(): boolean;

Defined in: animation/AnimationState.ts:1330

Whether the animation state is playing.

Returns ​

boolean


totalTime ​

Get Signature ​

ts
get totalTime(): number;

Defined in: animation/AnimationState.ts:1360

The total time. (In seconds)

Returns ​

number


weight ​

Get Signature ​

ts
get weight(): number;

Defined in: animation/AnimationState.ts:1416

The blend weight.

Default ​
ts
1.0
Returns ​

number

Set Signature ​

ts
set weight(value: number): void;

Defined in: animation/AnimationState.ts:1419

Parameters ​
ParameterType
valuenumber
Returns ​

void

Methods ​

activeTimeline() ​

ts
activeTimeline(): void;

Defined in: animation/AnimationState.ts:1287

Internal

Returns ​

void


addBoneMask() ​

ts
addBoneMask(boneName: string, recursive: boolean): void;

Defined in: animation/AnimationState.ts:1155

Add a specific bone mask.

Parameters ​

ParameterTypeDefault valueDescription
boneNamestringundefinedThe bone name.
recursivebooleantrueWhether or not to add a mask to the bone's sub-bone.

Returns ​

void


advanceTime() ​

ts
advanceTime(passedTime: number, cacheFrameRate: number): void;

Defined in: animation/AnimationState.ts:779

Internal

Parameters ​

ParameterType
passedTimenumber
cacheFrameRatenumber

Returns ​

void


containsBoneMask() ​

ts
containsBoneMask(boneName: string): boolean;

Defined in: animation/AnimationState.ts:1139

Check if a specific bone mask is included.

Parameters ​

ParameterTypeDescription
boneNamestringThe bone name.

Returns ​

boolean


fadeOut() ​

ts
fadeOut(fadeOutTime: number, pausePlayhead: boolean): void;

Defined in: animation/AnimationState.ts:1075

Fade out the animation state.

Parameters ​

ParameterTypeDefault valueDescription
fadeOutTimenumberundefinedThe fade out time. (In seconds)
pausePlayheadbooleantrueWhether to pause the animation playing when fade out.

Returns ​

void


init() ​

ts
init(
   armature: Armature, 
   animationData: AnimationData, 
   animationConfig: AnimationConfig): void;

Defined in: animation/AnimationState.ts:696

Internal

Parameters ​

ParameterType
armatureArmature
animationDataAnimationData
animationConfigAnimationConfig

Returns ​

void


play() ​

ts
play(): void;

Defined in: animation/AnimationState.ts:1049

Continue play.

Returns ​

void


removeAllBoneMask() ​

ts
removeAllBoneMask(): void;

Defined in: animation/AnimationState.ts:1229

Remove all bone masks.

Returns ​

void


removeBoneMask() ​

ts
removeBoneMask(boneName: string, recursive: boolean): void;

Defined in: animation/AnimationState.ts:1188

Remove the mask of a specific bone.

Parameters ​

ParameterTypeDefault valueDescription
boneNamestringundefinedThe bone name.
recursivebooleantrueWhether to remove the bone's sub-bone mask.

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


stop() ​

ts
stop(): void;

Defined in: animation/AnimationState.ts:1059

Stop play.

Returns ​

void


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: animation/AnimationState.ts:41

Returns ​

string

Overrides ​

BaseObject.toString

Released under the MIT License.