Skip to content

Commit 6406eaf

Browse files
committed
Use setAnimationLoop
1 parent 70f5568 commit 6406eaf

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/lib/scene-manager.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,16 @@ export class SceneManager {
6060

6161
render(containerEl: Element): void {
6262
containerEl.appendChild(this.renderer.domElement);
63-
requestAnimationFrame(this.animate.bind(this));
63+
this.renderer.setAnimationLoop(this.animate.bind(this));
6464
this.spawnSound();
6565
}
6666

6767
/**
6868
* Render the current frame.
6969
*/
7070
private animate(): void {
71-
requestAnimationFrame(this.animate.bind(this));
72-
7371
const delta = this.clock.getDelta();
72+
7473
this.resizeRendererToDisplaySize();
7574
this.moveGridsInfinitely(delta);
7675
this.moveTitleUntilRest(delta);

0 commit comments

Comments
 (0)