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.stop()

AnimationAction.stop() 方法是 AnimationAction 类型中的一个方法,用于停止当前动画操作,将当前时间重置为起始时间,并清除动画参数。

语法

animationAction.stop();

参数

该方法没有任何参数。

返回值

该方法没有任何返回值。

说明

调用 AnimationAction.stop() 方法后,当前动画操作将停止,并重置动画当前时间为起始时间。同时,清除动画中设置的所有参数,如开始、结束时间、循环方式等。

在动画中,通常会调用 AnimationAction.play() 方法来开始执行动画。当需要停止动画时,可以调用该方法来停止当前的动画操作。同时,如果需要再次播放动画,可以调用 AnimationAction.play() 方法重新开始执行动画操作。

示例

以下示例展示了如何使用 AnimationAction.stop() 方法停止当前的动画操作:

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

// 在某个条件下停止动画
animationAction.stop();

总结

AnimationAction.stop() 方法是 AnimationAction 类型中的一个方法,用于停止当前动画操作。调用该方法可以将当前动画操作重置为起始时间并清除动画参数。常常与 AnimationAction.play() 方法一起使用,用于开始或停止动画播放。