worker orbs: run at ~30fps when reduce-effects is on (perf)
Pairs with the previous commit (orbs now run under reduce-effects). When the user has asked for performance (reduce-effects on) we don't need the orbs at 60fps — the slow drift and sparks are indistinguishable at 30, and dropping every other render roughly halves the per-frame canvas cost, keeping the "orbs under reduce-effects" experiment cheap. The canvas still ticks at 60fps and frameCount still increments every tick, so `time` stays real-time and the drift speed is unchanged — we just draw it half as often. Precedence: the existing fully-asleep ~20fps throttle still wins; the 30fps cap only applies awake + reduce-effects. Chrome users with full effects keep 60fps — no reason to dim them.
This commit is contained in:
parent
79383df6d8
commit
34adb6fb32
1 changed files with 12 additions and 4 deletions
|
|
@ -605,10 +605,18 @@
|
|||
if (performance.now() < _scrollPauseUntil) return;
|
||||
|
||||
frameCount++;
|
||||
// Fully asleep: render at ~20fps. The drift is at crawl speed so the
|
||||
// difference is invisible, and the canvas GPU cost drops by two thirds
|
||||
// for the hours the dashboard sits idle. Wakes re-run every frame.
|
||||
if (sleepLevel > 0.95 && frameCount % 3 !== 0) return;
|
||||
// Frame-skip throttles. The canvas ticks at 60fps; we drop renders to cut cost.
|
||||
// frameCount still increments every tick, so `time` below stays real-time and the
|
||||
// drift speed is unchanged — we just draw it less often.
|
||||
if (sleepLevel > 0.95) {
|
||||
// Fully asleep → ~20fps: drift is at crawl speed so it's invisible, and the
|
||||
// GPU cost drops two-thirds for the hours the dashboard sits idle.
|
||||
if (frameCount % 3 !== 0) return;
|
||||
} else if (window._reduceEffectsActive) {
|
||||
// Reduce-effects on (user asked for performance) → ~30fps: the slow drift and
|
||||
// sparks look the same, the per-frame cost roughly halves.
|
||||
if (frameCount % 2 !== 0) return;
|
||||
}
|
||||
const time = frameCount / 60;
|
||||
const w = canvas.width;
|
||||
const h = canvas.height;
|
||||
|
|
|
|||
Loading…
Reference in a new issue