Adaptive surface control card
Edit the text, drag the slider or toggle effects while changing tiers above.
I wanted to know if PressureObserver can step a live drawable canvas down from a WebGL shader to a 30 fps 2D canvas, then an on-demand 2D canvas, and finally plain HTML via moveBefore() without dropping what you typed. Type in the card below, then switch pressure tiers or burn CPU briefly to watch the backend change underneath it.
Edit the text, drag the slider or toggle effects while changing tiers above.
Checking PressureObserver…
#card-host, moved into a WebGL or 2D canvas and back out again with moveBefore().ElementGL, 30 fps 2D, on-demand 2D and plain DOM while retiring replaced canvases via window.__gfx?.retire().cpu pressure samples at 1,000 ms intervals and feeding the tier switcher.
The card starts as ordinary HTML in #card-host, then upgrades to the fair 2D route on load so the page doesn't open a WebGL context before it's needed. When PressureObserver reports a CPU state (or when you pick a tier in the selector), the stage hands the same <article> element between backends using moveBefore().
| Tier | Backend | Frame budget | What changes |
|---|---|---|---|
nominal |
WebGL 2 via ElementGL |
60 fps while on screen | Uploads the card with texElementSubImage2D() only when it changes, draws chromatic glass refraction and ripple distortion, and keeps hit boxes aligned with updateElementGeometry(). |
fair |
2D canvas via drawElementImage() |
30 fps throttled | Disposes the WebGL stage, moves the card into a 2D canvas and retires the WebGL canvas with window.__gfx?.retire(). Draws a light tilt and drifting highlight with a 5-argument drawElementImage() call. |
serious |
2D canvas on-demand | 0 idle frames | Stops the requestAnimationFrame loop completely. The canvas paints only when Chromium fires a paint event (for example when you type, drag the slider or press a toggle). |
critical |
Plain HTML | 0 frames, 0 canvases | Calls moveBefore() to lift the live card straight back into #card-host, removes drawable and retires the canvas so canvas memory drops to 0.0 MB while your text and controls stay intact. |
Pressing "Burn CPU briefly (1.5 s)" spawns up to four short-lived Web Workers (falling back to chunked main-thread work if workers are blocked) for 1.5 seconds so you can push real CPU load without locking the page. Any continuous animation pauses automatically when the stage leaves the viewport or the tab is hidden, and stops animating when prefers-reduced-motion: reduce is set.
These four checks run on isolated fixtures in the corner of the window, never on the card above. Because two of them create a WebGL context and wait for canvas retirement, they wait for a tap.
fair tier avoids opening a WebGL context at load, while letting a live nominal sensor reading or a tap upgrade the same card to ElementGL.moveBefore() to move the card between a WebGL canvas, a 2D canvas and the plain #card-host container keeps strict DOM node identity (===), typed text, slider position and toggle state across all four tiers.window.__gfx?.retire(oldCanvas) after removing a canvas hands its WebGL context or 2D buffer back to the site guard instead of waiting for garbage collection, so stepping to critical drops the card's canvas memory to 0.0 MB.serious tier, stopping requestAnimationFrame and avoiding timer-driven DOM edits inside the card keeps idle paints at zero; Chromium fires paint only when you interact with a control.PressureObserver.observe('cpu') may report nominal straight away on desktop hardware, or reject in restricted frames and headless containers. Having manual tier overrides and a short CPU burst button lets you verify every tier on any device.