Peek, pop and scrubbable lightbox
I wanted to know if one WebGL canvas can bridge six live HTML tiles, long-press Peek-and-Pop circular bokeh blur, and a 1:1 finger-scrubbed inspector that throws back with spring velocity into its originating slot. Tap a heart or pin button directly, tap Peek or long-press (240 ms) to lift with optical bokeh, or tap any card body to pop it open and edit its live caption.
Show the code 6 drawable cards, 28-tap bokeh shader, throw-back spring and hit sync
- Six live cards inside one drawable canvas. Each
<article drawable>lays out at inspector resolution and scales into its grid cell, keeping live buttons and a caption<input>inside the same DOM tree. - Two-pass circular optical bokeh shader. Renders the five background tiles plus a recessed originating socket into an offscreen RGBA8 framebuffer, then blurs with 28 golden-angle Vogel disk samples scaled from
0to18 px. - Continuous pose interpolation and throw-back spring. Maps
tacross Grid (0), Peek lift (0.5at1.08xscale) and Popped inspector (1.0), tracking 1:1 finger drags with velocity Z-tilt and damped spring return. - Hit-box calibration and background isolation. Scales each card's
DOMMatrixbygeometryUnit()forupdateElementGeometry(), togglesdataset.hitTick, marks background tilesinertand sends them offstage while popped. - Five-argument 2D and plain-HTML fallbacks. Falls back to
drawElementImage(card, 0, 0, w, h)if WebGL 2 isn't available, or moves all six cards to a CSS grid on context loss.
How it works
Snapshot-based View Transitions freeze the outgoing and incoming states as static compositor textures, so you can't stop halfway through a pop, tilt a card under your finger, or scrub it back into its grid slot with release velocity.
Here all six <article drawable> cards stay live inside one <canvas content="drawable" layoutsubtree> managed by a single ElementGL WebGL 2 context.
Each card lays out at full inspector dimensions (cardW by cardH, matching the grid cell aspect ratio) and only re-uploads via gl.texElementSubImage2D() when its DOM changes or a paint event arrives.
At rest (t = 0), all six tiles render directly to the default framebuffer at full device DPI with zero offscreen passes.
When you tap Peek or hold for 240 ms, t lifts toward 0.5: the chosen card rises to 1.08x its tile scale with pointer tilt and a rounded drop shadow while the other five cards render into a half-resolution RGBA8 framebuffer behind a recessed socket outline.
A 28-tap golden-angle Vogel disk shader samples that framebuffer with circular aperture weighting and highlight bloom as blur radius grows continuously from 0 to 18 px.
Tapping a card body pops it to t = 1, unlocking its caption <input> and Close button while marking the five background cards inert and moving their hit boxes offstage.
Dragging vertically or diagonally tracks 1:1 with your finger and tilts the card by horizontal pointer velocity (rotZ = vx * k) while un-blurring the grid beneath; flinging past 90 px or 480 px/s seeds a damped spring straight back into that card's grid slot.
Live checks
These checks wait for a tap so the page opens with one WebGL context. Each check runs on isolated fixtures on the test stage without moving focus or scrolling the demo above.
Findings
- Not verified yet in a live browser: none of the checks or gestures have been run in headless Chromium 157 or on Chrome 159 for Android yet. Open the page with HTML-in-canvas enabled and press Run to record measured values.
- Laying each card out at its popped inspector size and downscaling into the grid at
t = 0avoids reallocating textures or snapping DOM layout between grid, peek and full-screen states, keeping caption text crisp att = 1. - Waiting to call
setPointerCapture()until after a 240 ms hold or an 8 px scrub drag keeps normal taps on inner heart, pin and peek buttons firing natively without swallowing clicks. - Marking the five blurred cards
inertand sending theirupdateElementGeometry()boxes offstage while popped prevents later DOM cards (such as slot 6 behind slot 1) from interceptingelementsFromPoint()hits on the active card.