API / AnimationState
类: AnimationState
定义于: animation/AnimationState.ts:40
动画状态由播放动画数据时产生。
继承
构造函数
构造函数
new AnimationState(): AnimationState;
返回
AnimationState
继承自
属性
_actionTimeline
_actionTimeline: ActionTimelineState;
定义于: animation/AnimationState.ts:213
Internal
_duration
_duration: number;
定义于: animation/AnimationState.ts:188
Internal
_fadeProgress
_fadeProgress: number;
定义于: animation/AnimationState.ts:195
Internal
_fadeState
_fadeState: number;
定义于: animation/AnimationState.ts:175
Internal
-1: Fade in, 0: Fade complete, 1: Fade out;
_parent
_parent: AnimationState;
定义于: animation/AnimationState.ts:220
Internal
_playheadState
_playheadState: number;
定义于: animation/AnimationState.ts:170
Internal
- xx: Play Enabled, Fade Play Enabled
_position
_position: number;
定义于: animation/AnimationState.ts:184
Internal
_subFadeState
_subFadeState: number;
定义于: animation/AnimationState.ts:180
Internal
-1: Fade start, 0: Fading, 1: Fade complete;
_weightResult
_weightResult: number;
定义于: animation/AnimationState.ts:199
Internal
autoFadeOutTime
autoFadeOutTime: number;
定义于: animation/AnimationState.ts:140
动画状态播放完成后的自动淡出时间。 [-1: 不自动淡出, [0~N]: 淡出时间] (以秒为单位)
默认值
-1.0
displayControl
displayControl: boolean;
定义于: animation/AnimationState.ts:64
动画状态是否对插槽的显示对象属性有控制权。 有时混合一个动画状态并不希望其控制插槽的显示对象属性, 尤其是其他动画状态正在控制这些插槽的显示对象属性时。
默认值
true
group
readonly group: string;
定义于: animation/AnimationState.ts:164
混合组名称。 该属性通常用来指定多个动画状态混合时的相互替换关系。
hashCode
readonly hashCode: number;
分配给此实例的唯一标识号。
继承自
layer
readonly layer: number;
定义于: animation/AnimationState.ts:100
混合图层。 图层高的动画状态会优先获取混合权重。 当混合权重分配超过 1 时,剩余的动画状态将不再获得权重分配。
name
readonly name: string;
定义于: animation/AnimationState.ts:153
动画状态名称。 (可以不同于动画数据)
playTimes
playTimes: number;
定义于: animation/AnimationState.ts:87
播放次数。 [0: 无限循环播放, [1~N]: 循环播放 N 次]
resetToPose
resetToPose: boolean;
定义于: animation/AnimationState.ts:75
开始播放动画状态时是否将没有动画的对象重置为骨架初始值。 通常在混合多个动画状态时应该将该属性设置为 false。
默认值
true
timeScale
timeScale: number;
定义于: animation/AnimationState.ts:113
播放速度。 该值与 Animation#timeScale 是叠加关系。 [(-N~0): 倒转播放, 0: 停止播放, (0~1): 慢速播放, 1: 正常播放, (1~N): 快速播放]
默认值
1.0
访问器
animationData
Getter 签名
get animationData(): AnimationData;
定义于: animation/AnimationState.ts:1446
动画数据。
返回
currentPlayTimes
Getter 签名
get currentPlayTimes(): number;
定义于: animation/AnimationState.ts:1350
已经循环播放的次数。
返回
number
currentTime
Getter 签名
get currentTime(): number;
定义于: animation/AnimationState.ts:1370
当前播放的时间。 (以秒为单位)
返回
number
Setter 签名
set currentTime(value: number): void;
定义于: animation/AnimationState.ts:1373
参数
参数 | 类型 |
---|---|
value | number |
返回
void
isCompleted
Getter 签名
get isCompleted(): boolean;
定义于: animation/AnimationState.ts:1340
是否播放完毕。
返回
boolean
isFadeComplete
Getter 签名
get isFadeComplete(): boolean;
定义于: animation/AnimationState.ts:1320
是否淡入或淡出完毕。
返回
boolean
isFadeIn
Getter 签名
get isFadeIn(): boolean;
定义于: animation/AnimationState.ts:1300
是否正在淡入。
返回
boolean
isFadeOut
Getter 签名
get isFadeOut(): boolean;
定义于: animation/AnimationState.ts:1310
是否正在淡出。
返回
boolean
isPlaying
Getter 签名
get isPlaying(): boolean;
定义于: animation/AnimationState.ts:1330
是否正在播放。
返回
boolean
totalTime
Getter 签名
get totalTime(): number;
定义于: animation/AnimationState.ts:1360
总播放时间。 (以秒为单位)
返回
number
weight
Getter 签名
get weight(): number;
定义于: animation/AnimationState.ts:1416
混合权重。
默认值
1.0
返回
number
Setter 签名
set weight(value: number): void;
定义于: animation/AnimationState.ts:1419
参数
参数 | 类型 |
---|---|
value | number |
返回
void
方法
activeTimeline()
activeTimeline(): void;
定义于: animation/AnimationState.ts:1287
Internal
返回
void
addBoneMask()
addBoneMask(boneName: string, recursive: boolean): void;
定义于: animation/AnimationState.ts:1155
添加特定的骨骼遮罩。
参数
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
boneName | string | undefined | 骨骼名称。 |
recursive | boolean | true | 是否为该骨骼的子骨骼添加遮罩。 |
返回
void
advanceTime()
advanceTime(passedTime: number, cacheFrameRate: number): void;
定义于: animation/AnimationState.ts:779
Internal
参数
参数 | 类型 |
---|---|
passedTime | number |
cacheFrameRate | number |
返回
void
containsBoneMask()
containsBoneMask(boneName: string): boolean;
定义于: animation/AnimationState.ts:1139
检查是否包含特定骨骼遮罩。
参数
参数 | 类型 | 描述 |
---|---|---|
boneName | string | 骨骼名称。 |
返回
boolean
fadeOut()
fadeOut(fadeOutTime: number, pausePlayhead: boolean): void;
定义于: animation/AnimationState.ts:1075
淡出动画状态。
参数
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
fadeOutTime | number | undefined | 淡出时间。 (以秒为单位) |
pausePlayhead | boolean | true | 淡出时是否暂停播放。 |
返回
void
init()
init(
armature: Armature,
animationData: AnimationData,
animationConfig: AnimationConfig): void;
定义于: animation/AnimationState.ts:696
Internal
参数
参数 | 类型 |
---|---|
armature | Armature |
animationData | AnimationData |
animationConfig | AnimationConfig |
返回
void
play()
play(): void;
定义于: animation/AnimationState.ts:1049
继续播放。
返回
void
removeAllBoneMask()
removeAllBoneMask(): void;
定义于: animation/AnimationState.ts:1229
删除所有骨骼遮罩。
返回
void
removeBoneMask()
removeBoneMask(boneName: string, recursive: boolean): void;
定义于: animation/AnimationState.ts:1188
删除特定骨骼的遮罩。
参数
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
boneName | string | undefined | 骨骼名称。 |
recursive | boolean | true | 是否删除该骨骼的子骨骼遮罩。 |
返回
void
returnToPool()
returnToPool(): void;
清除该实例的所有数据并将其返还对象池。
返回
void
继承自
stop()
stop(): void;
定义于: animation/AnimationState.ts:1059
暂停播放。
返回
void
borrowObject()
static borrowObject<T>(objectConstructor: () => T): T;
从对象池中获取特定类的实例。
类型参数
类型参数 |
---|
T extends BaseObject |
参数
参数 | 类型 | 描述 |
---|---|---|
objectConstructor | () => T | 特定的类。 |
返回
T
继承自
clearPool()
static clearPool(objectConstructor: typeof BaseObject): void;
清除特定对象池的缓存实例。
参数
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
objectConstructor | typeof BaseObject | null | 特定的类。 (不设置则清除所有缓存的实例) |
返回
void
继承自
setMaxCount()
static setMaxCount(objectConstructor: typeof BaseObject, maxCount: number): void;
设置特定对象池的最大缓存数量。
参数
参数 | 类型 | 描述 |
---|---|---|
objectConstructor | typeof BaseObject | 特定的类。 (不设置则设置所有对象池的最大缓存数量) |
maxCount | number | 最大缓存数量。 |
返回
void
继承自
toString()
static toString(): string;
定义于: animation/AnimationState.ts:41
返回
string