Luminous sweep spreadsheet reveal
I rebuilt Noman Ijaz's glimm Spreadsheet Transition (original post) with a real HTML <table> inside one ElementGL WebGL 2 canvas. Trigger a sweep, sort a column or freeze the wavefront mid-way with the slider while you edit quantities and watch totals recalculate behind the light band.
Starting canvas…
Show the code drawable spreadsheet table, luminous sweep shader, FBO snapshot capture, geometry sync and 2D fallback
- The semantic
<table>inside one drawable canvas. All sort buttons, decimal<input>cells and<tfoot>totals sit inside#sheet-card. - Upward luminous sweep fragment shader. Draws either a grid-aligned shimmering skeleton or the pre-sort FBO snapshot above the wavefront, applies a 7-tap Gaussian blur with chromatic dispersion inside the band, and illuminates grid lines along the golden-cyan crest.
- Offscreen WebGL FBO capture before DOM mutation. Renders the live DOM texture into an offscreen RGBA8 framebuffer right before sorting or clearing so the wavefront dissolves the previous state into the updated rows without CPU readback.
- Hit-box calibration with
geometryUnit(). Keeps sort header buttons and editable<input>fields aligned 1:1 on high-DPI screens, including when frozen mid-sweep. - Five-argument 2D and plain-HTML fallbacks. Clips a 2D sweep reveal with 5-argument
drawElementImage()and a bright linear gradient when WebGL 2 isn't available, or extracts#sheet-cardinto plain HTML on context loss.
How it works
- This rebuilds Noman Ijaz's glimm Spreadsheet Transition (original post) on one
<canvas content="drawable" layoutsubtree>managed by a singleElementGLWebGL 2 context. - When you click "Sweep reveal" or scrub back from a populated table, the shader measures header, column and row bounds from the DOM once per paint and renders a pixel-aligned empty grid with pulsing skeleton pills above the wavefront, blending across a directional blur and golden-cyan light crest into the live table below.
- When you click a column header to sort, press "Populate sample" or press "Clear & sweep", the handler copies the current DOM texture into an offscreen WebGL framebuffer (
prevFbo) before mutating the DOM, reorders rows withmoveBefore()(or updates inputs and totals), waits for the nextpaintupload viagl.texElementSubImage2D(), and sweeps upward from the captured snapshot into the live updated rows. - Because
updateElementGeometry()receives ageometryUnit()-calibrated transform and togglesdataset.hitTick, every sort button and quantity<input>stays clickable and editable even while the luminous band is frozen mid-sweep with the scrub slider. - If
texElementSubImage2D()isn't available, the canvas swaps to a 2D context drawing the reveal with 5-argumentdrawElementImage(), a clip region and a bright sweep gradient. If the context is lost or the API isn't enabled,#sheet-cardmoves out to plain HTML so editing and sorting continue working.
Live checks
Each check builds its own isolated fixture on the hidden test stage and retires its canvas when finished. The spreadsheet above isn't altered.
| Result | Experiment | Detail |
|---|
Findings
Not verified yet in a live browser. Tap "Run these 5 checks" above to measure this browser.
- Not verified yet: real rendering, FBO Y-orientation alignment, mid-sweep
readPixels()luminance across skeleton and crest,elementsFromPoint()hit testing on sort headers and<input>cells, and touch interaction on Chrome 159 for Android at 412 px wide. - Zero CPU readback during transitions: copying the live
texElementSubImage2D()texture into an offscreen WebGL FBO before DOM mutation keeps pre-sort and pre-clear snapshots entirely on the GPU, leavingopenSnapshotsat 0 and avoidinggetImageData()orreadPixels()inside the render loop. - FBO vs default-framebuffer Y orientation: drawing into an FBO with
gl_Position = vec4(aPos * 2.0 - 1.0, 0.0, 1.0)andvUv = aPoswrites row 0 of the DOM texture into row 0 of the FBO texture, matchingtexElementSubImage2D()without flipping vertically when sampled in the main sweep pass.