BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

AnimationAction.play()

概述

AnimationAction.play() 方法是 three.js 中的一个动画控制方法,用于播放已构建的动画动作,并返回相应的 AnimationMixer

语法

animationAction.play()

返回值

AnimationMixer 对象,用于检查或操作动画的状态。

描述

AnimationAction.play() 方法通过启动动画时间轴来播放已定义的动作。调用此方法只能在停止或暂停状态下工作,如果动画正在运行,则会忽略此方法的调用。

示例

const mixer = new THREE.AnimationMixer( mesh );
const action = mixer.clipAction( animationClip );

action.play();

注意事项

  • clipAction() 方法必须在使用 play() 方法之前调用,否则方法将无法正常运行。
  • 在某些情况下,可以使用 timetimeScale 属性操作和调节动画。
  • 需要将带有动画数据的 mesh 添加到场景中后才能播放动画(使用 scene.add( mesh ) 方法)。
  • AnimationMixer 对象是寿命有限的,因此应该在不需要时及时调用其 dispose() 方法释放内存。