微信小程序

KeyframeAnimation

xr-frame / Exports / KeyframeAnimation

# Class: KeyframeAnimation

Keyframe动画。

# Hierarchy

  • Animation<IKeyframeAnimationData, IKeyframeAnimationOptions>

    KeyframeAnimation

# Table of contents

# Constructors

  • constructor

# Events

  • onInit
  • onPause
  • onPlay
  • onResume
  • onStop
  • onUpdate

# Properties

  • clipNames

# Accessors

  • scene

# Constructors

# constructor

new KeyframeAnimation(_scene, data)

# Parameters
Name Type Description
_scene Scene 场景实例。
data IKeyframeAnimationData 初始化动画数据。
# Inherited from

Animation.constructor

# Events

# onInit

onInit(data): void

动画初始化时执行的生命周期,只会执行一次。

# Parameters
Name Type
data IKeyframeAnimationData
# Returns

void

# Inherited from

Animation.onInit

# onPause

onPause(el): void

在动画暂停时执行的回调。

# Parameters
Name Type
el Element
# Returns

void

# Inherited from

Animation.onPause

# onPlay

onPlay(el, clipName, options): IKeyframeAnimationInfo

动画开始播放时执行的生命周期。

# Parameters
Name Type
el Element
clipName string
options IKeyframeAnimationOptions
# Returns

IKeyframeAnimationInfo

返回本次播放片段的参数,必须包括时长duration(s),可选循环次数loop、延迟delay和方向direction

# Inherited from

Animation.onPlay

# onResume

onResume(el): void

在动画从暂停状态唤醒时执行的回调。

# Parameters
Name Type
el Element
# Returns

void

# Inherited from

Animation.onResume

# onStop

onStop(el): void

在动画停止时执行的回调。

# Parameters
Name Type
el Element
# Returns

void

# Inherited from

Animation.onStop

# onUpdate

onUpdate(el, progress, reverse): void

在动画更新时执行的回调。

# Parameters
Name Type
el Element
progress number
reverse boolean
# Returns

void

# Inherited from

Animation.onUpdate

# Properties

# clipNames

clipNames: string[]

动画所有的片段名字,必须在onInit中被初始化。

# Inherited from

Animation.clipNames

# Accessors

# scene

get scene(): Scene

场景实例。

# Returns

Scene