xr-frame / Exports / KeyframeAnimation
# Class: KeyframeAnimation
Keyframe动画。
# Hierarchy
Animation<IKeyframeAnimationData,IKeyframeAnimationOptions>↳
KeyframeAnimation
# Table of contents
# Constructors
# Events
# Properties
# Accessors
# Constructors
# constructor
• new KeyframeAnimation(_scene, data)
# Parameters
| Name | Type | Description |
|---|---|---|
_scene | Scene | 场景实例。 |
data | IKeyframeAnimationData | 初始化动画数据。 |
# Inherited from
# Events
# onInit
▸ onInit(data): void
动画初始化时执行的生命周期,只会执行一次。
# Parameters
| Name | Type |
|---|---|
data | IKeyframeAnimationData |
# Returns
void
# Inherited from
# onPause
▸ onPause(el): void
在动画暂停时执行的回调。
# Parameters
| Name | Type |
|---|---|
el | Element |
# Returns
void
# Inherited from
# onPlay
▸ onPlay(el, clipName, options): IKeyframeAnimationInfo
动画开始播放时执行的生命周期。
# Parameters
| Name | Type |
|---|---|
el | Element |
clipName | string |
options | IKeyframeAnimationOptions |
# Returns
返回本次播放片段的参数,必须包括时长duration(s),可选循环次数loop、延迟delay和方向direction。
# Inherited from
# onResume
▸ onResume(el): void
在动画从暂停状态唤醒时执行的回调。
# Parameters
| Name | Type |
|---|---|
el | Element |
# Returns
void
# Inherited from
# onStop
▸ onStop(el): void
在动画停止时执行的回调。
# Parameters
| Name | Type |
|---|---|
el | Element |
# Returns
void
# Inherited from
# onUpdate
▸ onUpdate(el, progress, reverse): void
在动画更新时执行的回调。
# Parameters
| Name | Type |
|---|---|
el | Element |
progress | number |
reverse | boolean |
# Returns
void
# Inherited from
# Properties
# clipNames
• clipNames: string[]
动画所有的片段名字,必须在onInit中被初始化。
# Inherited from
# Accessors
# scene
• get scene(): Scene
场景实例。