Folds shader preview: Huge sheets of dark glass, seen close and out of focus, with light rolling over their curves.
ittybitty

Folds

Huge sheets of dark glass, seen close and out of focus, with light rolling over their curves.

Code

Use as
Code view

Copy embed: paste into Webflow, Framer, Squarespace or any HTML · Copy for agent: paste into Cursor or Claude · Copy code: the files for your own build.

For your own build, add folds.js, ittybitty-shader.js, runtime.js and pointer.js next to this page. Highlighted values follow the controls.

<!-- Quickest: one element. Size it with CSS; it fills its box. -->
<script type="module" src="./ittybitty-shader.js"></script>
<ittybitty-shader effect="folds" style="width: 100%; aspect-ratio: 16 / 9;"></ittybitty-shader>

<!-- Or with JavaScript, for full control: -->
<canvas id="folds" aria-hidden="true" style="width: 100%; aspect-ratio: 16 / 9; display: block"></canvas>

<script type="module">
  import { folds } from './folds.js';

  const canvas = document.getElementById('folds');
  const effect = folds(canvas, {
    speed: 0.3,
    sheets: 4,
    curvature: 1,
    gloss: 0.3,
    edge: 0.6,
    softness: 0.5,
    angle: 150,
    exposure: 1,
    grain: 0.5,
    light: '#6ea8f0',
    accent: '#8c86e8',
    shadow: '#030409',
    interactive: true,
    responsiveness: 0.5,
    // Performance
    dpr: 1.5,
    adaptive: true,
  });

  // Later: effect.set(…), effect.pause(), effect.resume(), effect.destroy()
</script>

Details

A few huge sheets of dark, glossy material layered close to the lens, like a macro shot of folded glass or a curved screen. Each sheet curls away from its edge, so a broad, soft highlight rolls across it and sinks into deep black, and where one sheet lies over another a thin sliver of light catches the fold. Sheets further back fall out of focus, the sheets slowly drift, and the pointer swings the light around.

Payload
7.7 KB brotli for folds.js, ittybitty-shader.js, runtime.js and pointer.js, measured at build time.
Resolution
Device pixel ratio capped at 1.5: the image is soft by design, so more pixels would only cost power.
Frame rate
Display rate.
When unseen
Stops rendering when the canvas leaves the viewport or the tab is hidden, and resumes where it left off.
Reduced motion
Shows a single still frame. Controls and the pointer still update it.
Layers
Up to five effects fuse into one shader and one draw call. Filters such as dithering and halftone process the layers beneath them.
Browsers
Any browser with WebGL2: Chrome and Edge 56+, Firefox 51+, Safari 15+.
Licence
MIT. Copy it, change it, ship it.