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

AnimationAction.setDuration(duration: number): AnimationAction

该方法用于设置动画动作的持续时间。参数duration表示动画动作的持续时间,单位为秒。

返回值为AnimationAction对象。

示例

以下示例展示了如何使用AnimationAction.setDuration()方法设置动画动作的持续时间。

import * as THREE from 'three';

const mixer = new THREE.AnimationMixer(scene);

const clip = THREE.AnimationClip.create(...);
const action = mixer.clipAction(clip);

action.setDuration(2); // 将动画动作的持续时间设置为2秒

参数

  • duration:动画动作的持续时间,单位为秒。

    • 类型:number

返回值

  • AnimationAction:动画动作对象。

    • 类型:AnimationAction

异常

  • 当传递的duration参数为负数时,会抛出以下异常:

    • THREE.WebGLAnimation.checkAnimation(): Invalid Animation ${animation.uuid}: duration is negative.

参考链接

修改历史