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

概述

AnimationAction.setLoop()方法用于设置动画循环方式。

语法

animationAction.setLoop( loopMode, repetitions );

参数

  • loopMode(必要参数):指定动画循环方式,可选取值为如下三个:
    • THREE.LoopOnce:动画只播放一次。
    • THREE.LoopRepeat:动画重复播放。
    • THREE.LoopPingPong:动画先向前播放,再向后播放,反复循环。
  • repetitions(可选参数):指定动画的循环次数,仅对重复播放循环方式生效。默认值为Infinity,表示无限循环。

示例

var mixer = new THREE.AnimationMixer( mesh );
var clip = THREE.AnimationClip.CreateFromMorphTargetSequence( 'morph', morphTargets, 30 );
var animationAction = mixer.clipAction( clip );
animationAction.setLoop( THREE.LoopOnce, 1 ); // 播放一遍
animationAction.play();

参考资料