Skip to content

API / AnimationState

类: AnimationState

定义于: animation/AnimationState.ts:40

动画状态由播放动画数据时产生。

继承

构造函数

构造函数

ts
new AnimationState(): AnimationState;

返回

AnimationState

继承自

BaseObject.constructor

属性

_actionTimeline

ts
_actionTimeline: ActionTimelineState;

定义于: animation/AnimationState.ts:213

Internal


_duration

ts
_duration: number;

定义于: animation/AnimationState.ts:188

Internal


_fadeProgress

ts
_fadeProgress: number;

定义于: animation/AnimationState.ts:195

Internal


_fadeState

ts
_fadeState: number;

定义于: animation/AnimationState.ts:175

Internal

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


_parent

ts
_parent: AnimationState;

定义于: animation/AnimationState.ts:220

Internal


_playheadState

ts
_playheadState: number;

定义于: animation/AnimationState.ts:170

Internal

  • xx: Play Enabled, Fade Play Enabled

_position

ts
_position: number;

定义于: animation/AnimationState.ts:184

Internal


_subFadeState

ts
_subFadeState: number;

定义于: animation/AnimationState.ts:180

Internal

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


_weightResult

ts
_weightResult: number;

定义于: animation/AnimationState.ts:199

Internal


autoFadeOutTime

ts
autoFadeOutTime: number;

定义于: animation/AnimationState.ts:140

动画状态播放完成后的自动淡出时间。 [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)

默认值

ts
-1.0

displayControl

ts
displayControl: boolean;

定义于: animation/AnimationState.ts:64

动画状态是否对插槽的显示对象属性有控制权。 有时混合一个动画状态并不希望其控制插槽的显示对象属性, 尤其是其他动画状态正在控制这些插槽的显示对象属性时。

默认值

ts
true

group

ts
readonly group: string;

定义于: animation/AnimationState.ts:164

混合组名称。 该属性通常用来指定多个动画状态混合时的相互替换关系。


hashCode

ts
readonly hashCode: number;

定义于: core/BaseObject.ts:156

分配给此实例的唯一标识号。

继承自

BaseObject.hashCode


layer

ts
readonly layer: number;

定义于: animation/AnimationState.ts:100

混合图层。 图层高的动画状态会优先获取混合权重。 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。


name

ts
readonly name: string;

定义于: animation/AnimationState.ts:153

动画状态名称。 (可以不同于动画数据)


playTimes

ts
playTimes: number;

定义于: animation/AnimationState.ts:87

播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]


resetToPose

ts
resetToPose: boolean;

定义于: animation/AnimationState.ts:75

开始播放动画状态时是否将没有动画的对象重置为骨架初始值。 通常在混合多个动画状态时应该将该属性设置为 false。

默认值

ts
true

timeScale

ts
timeScale: number;

定义于: animation/AnimationState.ts:113

播放速度。 该值与 Animation#timeScale 是叠加关系。 [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]

默认值

ts
1.0

访问器

animationData

Getter 签名

ts
get animationData(): AnimationData;

定义于: animation/AnimationState.ts:1446

动画数据。

返回

AnimationData


currentPlayTimes

Getter 签名

ts
get currentPlayTimes(): number;

定义于: animation/AnimationState.ts:1350

已经循环播放的次数。

返回

number


currentTime

Getter 签名

ts
get currentTime(): number;

定义于: animation/AnimationState.ts:1370

当前播放的时间。 (以秒为单位)

返回

number

Setter 签名

ts
set currentTime(value: number): void;

定义于: animation/AnimationState.ts:1373

参数
参数类型
valuenumber
返回

void


isCompleted

Getter 签名

ts
get isCompleted(): boolean;

定义于: animation/AnimationState.ts:1340

是否播放完毕。

返回

boolean


isFadeComplete

Getter 签名

ts
get isFadeComplete(): boolean;

定义于: animation/AnimationState.ts:1320

是否淡入或淡出完毕。

返回

boolean


isFadeIn

Getter 签名

ts
get isFadeIn(): boolean;

定义于: animation/AnimationState.ts:1300

是否正在淡入。

返回

boolean


isFadeOut

Getter 签名

ts
get isFadeOut(): boolean;

定义于: animation/AnimationState.ts:1310

是否正在淡出。

返回

boolean


isPlaying

Getter 签名

ts
get isPlaying(): boolean;

定义于: animation/AnimationState.ts:1330

是否正在播放。

返回

boolean


totalTime

Getter 签名

ts
get totalTime(): number;

定义于: animation/AnimationState.ts:1360

总播放时间。 (以秒为单位)

返回

number


weight

Getter 签名

ts
get weight(): number;

定义于: animation/AnimationState.ts:1416

混合权重。

默认值
ts
1.0
返回

number

Setter 签名

ts
set weight(value: number): void;

定义于: animation/AnimationState.ts:1419

参数
参数类型
valuenumber
返回

void

方法

activeTimeline()

ts
activeTimeline(): void;

定义于: animation/AnimationState.ts:1287

Internal

返回

void


addBoneMask()

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

定义于: animation/AnimationState.ts:1155

添加特定的骨骼遮罩。

参数

参数类型默认值描述
boneNamestringundefined骨骼名称。
recursivebooleantrue是否为该骨骼的子骨骼添加遮罩。

返回

void


advanceTime()

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

定义于: animation/AnimationState.ts:779

Internal

参数

参数类型
passedTimenumber
cacheFrameRatenumber

返回

void


containsBoneMask()

ts
containsBoneMask(boneName: string): boolean;

定义于: animation/AnimationState.ts:1139

检查是否包含特定骨骼遮罩。

参数

参数类型描述
boneNamestring骨骼名称。

返回

boolean


fadeOut()

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

定义于: animation/AnimationState.ts:1075

淡出动画状态。

参数

参数类型默认值描述
fadeOutTimenumberundefined淡出时间。 (以秒为单位)
pausePlayheadbooleantrue淡出时是否暂停播放。

返回

void


init()

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

定义于: animation/AnimationState.ts:696

Internal

参数

参数类型
armatureArmature
animationDataAnimationData
animationConfigAnimationConfig

返回

void


play()

ts
play(): void;

定义于: animation/AnimationState.ts:1049

继续播放。

返回

void


removeAllBoneMask()

ts
removeAllBoneMask(): void;

定义于: animation/AnimationState.ts:1229

删除所有骨骼遮罩。

返回

void


removeBoneMask()

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

定义于: animation/AnimationState.ts:1188

删除特定骨骼的遮罩。

参数

参数类型默认值描述
boneNamestringundefined骨骼名称。
recursivebooleantrue是否删除该骨骼的子骨骼遮罩。

返回

void


returnToPool()

ts
returnToPool(): void;

定义于: core/BaseObject.ts:167

清除该实例的所有数据并将其返还对象池。

返回

void

继承自

BaseObject.returnToPool


stop()

ts
stop(): void;

定义于: animation/AnimationState.ts:1059

暂停播放。

返回

void


borrowObject()

ts
static borrowObject<T>(objectConstructor: () => T): T;

定义于: core/BaseObject.ts:136

从对象池中获取特定类的实例。

类型参数

类型参数
T extends BaseObject

参数

参数类型描述
objectConstructor() => T特定的类。

返回

T

继承自

BaseObject.borrowObject


clearPool()

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

定义于: core/BaseObject.ts:111

清除特定对象池的缓存实例。

参数

参数类型默认值描述
objectConstructortypeof BaseObjectnull特定的类。 (不设置则清除所有缓存的实例)

返回

void

继承自

BaseObject.clearPool


setMaxCount()

ts
static setMaxCount(objectConstructor: typeof BaseObject, maxCount: number): void;

定义于: core/BaseObject.ts:72

设置特定对象池的最大缓存数量。

参数

参数类型描述
objectConstructortypeof BaseObject特定的类。 (不设置则设置所有对象池的最大缓存数量)
maxCountnumber最大缓存数量。

返回

void

继承自

BaseObject.setMaxCount


toString()

ts
static toString(): string;

定义于: animation/AnimationState.ts:41

返回

string

重写了

BaseObject.toString

Released under the MIT License.