Scroll-linked shaders with no scroll listener

Scroll the page. Each block below is HTML drawn through a fragment shader, and the shader's inputs are CSS custom properties that scroll-driven animations, a scroll-state() container query and a scroll-triggered animation set. The page has no scroll listener and no observer. Scroll fast to blur the blocks by the scroll speed. The buttons and fields keep working.

Scroll this page

This block melts as it leaves the top of the screen. A view timeline moves --fx-progress over the exit range.

Sticky bar

Burn in

A view timeline moves --fx-progress from 0 to 1 as this block comes up from the bottom edge. Scroll back down and it burns away again.

Mosaic

The same timeline and the same property. The shader samples the block in square cells that shrink from 40 px to 1 px.

Rows

Rows 14 px tall start off to the left and to the right and slide home. Stop half way and press the button: it's where the layout says, the shader only moves pixels.

Unroll

The block is a sheet rolled up at its top edge. The cylinder rolls down the page as you scroll and winds back up when you scroll the other way.

The grey band is the back of the sheet. Its shading is the cylinder's.

Triggered, not scrubbed

This one runs for 900 ms by the clock. A timeline trigger starts it when the whole block is on screen and resets it when the block has left.

Show the code CSS timelines → custom properties → shader
  1. The markup. Ordinary sections. fx names the shader, the classes name the CSS that drives it.
  2. A view timeline sets --fx-progress. The fx library registers the property as a number and passes it to the shader as u_progress.
  3. The page's scroll position as a property.
  4. Scroll speed from a transition. A second property follows the first one 120 ms late. Their difference is the speed.
  5. A scroll-state() query sets --fx-amount on the sticky bar.
  6. A timeline trigger starts a timed animation.
  7. A shader that reads the progress. GLSL for WebGL and WGSL for WebGPU.
  8. The blur that reads the speed.
  9. The roll.
  10. The sticky bar's shader.
  11. The page script. It picks the drawing route and loads the library. Nothing in it reads the scroll position.
  12. Inside the library: the upload and the draw.

How it works

Live checks

Each check builds a small scroller of its own in a corner of the window and scrolls that. The page isn't scrolled.

ResultExperimentDetail

Findings

From Chromium 157 with software rendering. The rows above say what your browser does.