From cda633bea18e86b6fc8c64bc54c830907ef57977 Mon Sep 17 00:00:00 2001 From: sayudhalw Date: Mon, 24 Aug 2026 07:32:53 +0700 Subject: [PATCH] refactor: replace clock with Timer for animation updates --- src/script.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/script.js b/src/script.js index 3e943c4..fc70ea6 100644 --- a/src/script.js +++ b/src/script.js @@ -1,5 +1,6 @@ import * as THREE from 'three' import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js' +import { Timer } from 'three/examples/jsm/misc/Timer.js' /** * Base @@ -49,11 +50,13 @@ renderer.setSize(sizes.width, sizes.height) /** * Animate */ -const clock = new THREE.Clock() +const timer = new Timer() +timer.connect(document) // pause otomatis saat tab tidak aktif const tick = () => { - const elapsedTime = clock.getElapsedTime() + timer.update() + const elapsedTime = timer.getElapsed() // Update controls controls.update()