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

keyframeTrack.InterpolantFactoryMethodLinear()

keyframeTrack.InterpolantFactoryMethodLinear() 是 three.js 中 KeyframeTrack 类的一个方法。该方法返回一个用于线性插值的插值器工厂函数。

语法

keyframeTrack.InterpolantFactoryMethodLinear()

返回值

keyframeTrack.InterpolantFactoryMethodLinear() 返回一个函数,用于创建线性插值器。

插值器工厂函数

插值器工厂函数的语法如下:

function interpolantFactoryMethodLinear(result)

result: 结果数组,用于存放插值后的值。
return: 线性插值器。

示例

let positionTrack = new THREE.VectorKeyframeTrack('obj.position', [0, 1, 2], [0, 0, 0, 10, 10, 10, 20, 10, 0]);
let scaleTrack = new THREE.VectorKeyframeTrack('obj.scale', [0, 1, 2], [1, 1, 1, 3, 3, 3, 1, 1, 1]);

let clip = new THREE.AnimationClip('default', 3, [positionTrack, scaleTrack]);
clip.prepare();

let mixer = new THREE.AnimationMixer(scene);
let action = mixer.clipAction(clip);
action.play();

let linearInterpolant = positionTrack.createInterpolant(new THREE.Float32Array(3), keyframeTrack.InterpolantFactoryMethodLinear());

以上示例创建了一个 AnimationClip 对象,其中包括了一个位置关键帧轨迹和一个缩放关键帧轨迹。通过 prepare() 函数将轨迹准备好后,创建 AnimationMixer 对象和动画动作(Action),并开始播放动画。最后,创建了一个用于位置轨迹的线性插值器。

参考链接