具有平滑(三次插值)的three.js KeyframeTrack示例

时间:2017-08-18 16:49:13

标签: javascript animation three.js keyframe cubic

我正在寻找一些关于如何在three.js动画KeyframeTrack上实现平滑(a.k.a. cubic interpolation)的清晰度。从我的测试来看,在KeyframeTrack构造函数中解析插值方法是不够的。

var position = new THREE.VectorKeyframeTrack(
    '.position',
    [0, 1],
    [
        plane.position.x,
        plane.position.y,
        plane.position.z,
        1.25 * plane.position.x,
        1.25 * plane.position.y,
        1.25 * plane.position.z
    ],
    THREE.InterpolateSmooth
);
position.createInterpolant();

var clip = new THREE.AnimationClip('Action', 3, [
    position
]);

that.mixer = new THREE.AnimationMixer(plane);

var action = that.mixer.clipAction(clip);
action.setLoop(THREE.LoopOnce);
action.startAt(0);                // delay in seconds
action.clampWhenFinished = true;
action.play();

0 个答案:

没有答案