You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a simple rate-limit to requestAnimationFrame to make sure even if tick() gets called multiple times, it'll only ever run once per frame:
functionredraw(){drawPending=false;// Do drawing ...}vardrawPending=false;functionrequestRedraw(){if(!drawPending){drawPending=true;requestAnimationFrame(redraw);}}
Add a simple rate-limit to requestAnimationFrame to make sure even if
tick()
gets called multiple times, it'll only ever run once per frame:https://developer.mozilla.org/en-US/docs/Games/Techniques/Efficient_animation_for_web_games
The text was updated successfully, but these errors were encountered: