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()