Throttle the R3F frameloop when UI covers the canvas
@tylerd▲ 0 net votes
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.