From f3eab1c169a776aea392ca229be0ece296abaa73 Mon Sep 17 00:00:00 2001 From: syui Date: Tue, 19 Mar 2024 13:07:07 +0900 Subject: [PATCH] rm update --- src/index.ts | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/index.ts b/src/index.ts index 37953861f..a756bfb68 100644 --- a/src/index.ts +++ b/src/index.ts @@ -99,21 +99,6 @@ window.addEventListener("DOMContentLoaded", () => { const clock = new THREE.Clock(); clock.start(); - const update = () => { - - controls.update(); - requestAnimationFrame(update); - const deltaTime = clock.getDelta(); - if (currentMixer) { - currentMixer.update(deltaTime); - } - if (currentVrm) { - currentVrm.update(deltaTime); - } - - renderer.render(scene, camera); - } - scene.background = new THREE.Color( 0xffffff ); const directionalLight = new THREE.DirectionalLight(0xffffff); directionalLight.position.set(1, 1, 1); @@ -157,9 +142,15 @@ window.addEventListener("DOMContentLoaded", () => { floor_grid(); floor_bg(); - update(); - function animate() { + controls.update(); + const delta = clock.getDelta(); + if (currentMixer) { + currentMixer.update(delta); + } + if (currentVrm) { + currentVrm.update(delta); + } requestAnimationFrame(animate); scene.rotation.y += 0.005; renderer.render(scene, camera);