Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

377
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!