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();