Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

382
Visualizações
ThreeJS - How to play animation between specific keyframes – forward and backward
  • Looking to get GLB(s) to advance to a specific KeyFrame via hovering over 1 of 3 buttons.
  • 'Advance' means move from current KF to desired (1, 21, 41)... could be forward or backward.
  • Mock-up of intended behavior: (https://imgur.com/N25k2gM).
  • Best I've been able to do thus far (.gif): https://imgur.com/N64oKj6
  • Been at the problem a couple hours. Put some effort in before I asked.

.

//*   Setup First Model

let modelBGReady = false;
let modelBGMixer: THREE.AnimationMixer;
const modelBGClock = new THREE.Clock();

//*   Load First Model

const modelBGLoad = new GLTFLoader();
modelBGLoad.load(modelBG, (gltf) => {

modelBGMixer = new THREE.AnimationMixer(gltf.scene);

let animation = modelBGMixer.clipAction(gltf.animations[0]);
animation.setLoop(THREE.LoopOnce, 1);
animation.clampWhenFinished = true;
animation.play();

gltf.scene.rotation.z += modelRotateX;
gltf.scene.rotation.y += modelRotateY;
gltf.scene.position.set(0, -0.5, 0.2);
scene.add(gltf.scene);});

...

//*   'Plan' Button Hover (Button 1 of 3)

const buttonPlan = document.getElementById('buttonPlan') as HTMLDivElement;
buttonPlan.addEventListener('mouseover', (event) => {
modelBGReady = true;
});

...

//*   Animation Loop

function animate() {

requestAnimationFrame(animate);

render();
if (modelBGReady) modelBGMixer.update(modelBGClock.getDelta());
if (modelUIReady) modelUIMixer.update(modelUIClock.getDelta());
if (modelWebAppsReady)
    modelWebAppsMixer.update(modelWebAppsClock.getDelta());
stats.update();
}

function render() {
renderer.render(scene, camera);
}
animate();

Help on this would be greatly appreciated.

You can tell this is for a web designer-type portfolio (which I'm excited to finish :) )

Cheers

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda