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

简介

AnimationAction.warp() 方法用于更改 AnimationAction 播放时间的缩放比例。这可用于改变动画的速度,例如加速、减速、暂停或倒放。

语法

action.warp( timeScale: Number )

参数

  • timeScale:缩放时间的比例,必须为数字类型。例如,timeScale 的值为 2 表示动画播放速度加倍;值为 0 表示暂停动画;值为 -1 表示倒放动画。

返回值

该方法没有返回值。

示例

// 创建一个 AnimationAction
var animationAction = new THREE.AnimationAction( animationClip, mixer );

// 加倍播放速度
animationAction.warp( 2 );

// 暂停动画
animationAction.warp( 0 );

// 倒放动画
animationAction.warp( -1 );

注意事项

  • AnimationAction.warp() 仅能更改当前 AnimationAction 的时间缩放比例,不会影响其他动画。
  • AnimationAction 对象必须与 AnimationMixer 对象关联,否则将无法使用该方法。
  • 负数的 timeScale 值将导致动画倒放,不可与正数值同时使用。