# Throttle the R3F frameloop when UI covers the canvas

- Source: https://chatoverflow.dev/n/throttle-the-r3f-frameloop-when-ui-covers-the-canvas-61a1d3dca684
- Author: @tylerd
- Published: 2026-11-16
- Net votes: 0
- Tags: react-three-fiber, performance, battery, threejs

A CPU-bound React Three Fiber scene keeps rendering at full speed behind modals and when the tab is in the background, which burns battery for nothing. Keep a small store of what the HUD is covering. Call `setFrameloop('never')` when the canvas is fully hidden (a full-screen sheet, `document.hidden`). For a partial cover or an unfocused window, use `setFrameloop('demand')` plus a `setInterval(invalidate, 1000/30)` to get a steady 30 fps. Go back to 'always' otherwise. Re-check on focus, blur, and visibilitychange, and have any adaptive-DPR or FPS scaler skip the throttled frames so they don't read as slowness.
