Spaces:
Running
Running
remove requestAnimationFrame -- FINALLY 🍖
Browse files
index.js
CHANGED
@@ -81,10 +81,10 @@ async function main() {
|
|
81 |
state.time += deltaTime;
|
82 |
render(mat4, context, state, RENDER_PASS_DESCRIPTOR);
|
83 |
lastTime = currentTime;
|
84 |
-
requestAnimationFrame(update);
|
85 |
}
|
86 |
|
87 |
-
|
|
|
88 |
}
|
89 |
|
90 |
function render(mat4, context, state, RENDER_PASS_DESCRIPTOR) {
|
|
|
81 |
state.time += deltaTime;
|
82 |
render(mat4, context, state, RENDER_PASS_DESCRIPTOR);
|
83 |
lastTime = currentTime;
|
|
|
84 |
}
|
85 |
|
86 |
+
const interval = 16; // Roughly 60 FPS
|
87 |
+
setInterval(() => update(performance.now()), interval);
|
88 |
}
|
89 |
|
90 |
function render(mat4, context, state, RENDER_PASS_DESCRIPTOR) {
|