.
//* 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