p3nGu1nZz commited on
Commit
6d5881c
·
1 Parent(s): 3207085

remove requestAnimationFrame -- FINALLY 🍖

Browse files
Files changed (1) hide show
  1. index.js +2 -2
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
- requestAnimationFrame(update);
 
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) {