我想在用变形目标创建的最后一帧处停止AnimationAction。
https://threejs.org/docs/#api/en/animation/AnimationAction
我已经尝试过animationAction.clampWhenFinished = true;
,但这似乎不起作用。
我查看了较旧的stackoverflow questions,并搜索了forums,但解决方案无效。
var cubeTarget1 = new THREE.BoxGeometry(20, 10, 10);
var cubeTarget2 = new THREE.BoxGeometry(20, 10, 50);
var cubeTarget3 = new THREE.BoxGeometry(60, 10, 10);
cubeGeometry.morphTargets[0] = {name: 't1', vertices: cubeTarget1.vertices};
cubeGeometry.morphTargets[1] = {name: 't2', vertices: cubeTarget2.vertices};
cubeGeometry.morphTargets[2] = {name: 't3', vertices: cubeTarget3.vertices};
有没有办法做类似的事情:(这不起作用,它会循环回到第一个morphTarget)
var clip1 = THREE.AnimationClip.CreateFromMorphTargetSequence('run', [cubeGeometry.morphTargets[0],cubeGeometry.morphTargets[1]], 30);
var action1 = mixer.clipAction(clip1);
action1.play(); // starts at cubeTarget1 ends at cubeTarget2 (animating between them, without a loop)
// and at a later point I'd like to do
var clip2 = THREE.AnimationClip.CreateFromMorphTargetSequence('run', [cubeGeometry.morphTargets[1],cubeGeometry.morphTargets[2]], 30);
var action2 = mixer.clipAction(clip2);
action2.play(); // starts at cubeTarget2 ends at cubeTarget3 (animating between them, without a loop)
答案 0 :(得分:0)
我看了three.js代码。而在LoopOnce内部,涉及lampingWhenFinished的部分根本不会被击中。
目前,我将以一种非常粗略的方式进行操作,直到找到更好的解决方案为止:
action.setDuration(5).play();
setTimeout(function()
{
action.paused = true;
},2500); // half of the duration