Skip to content

Commit

Permalink
rm update
Browse files Browse the repository at this point in the history
  • Loading branch information
syui committed Mar 19, 2024
1 parent 7c3912e commit f3eab1c
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f3eab1c

Please sign in to comment.