Drop Ripple shader preview: A shockwave of light through any image, or the layers beneath.
ittybitty

Drop Ripple

A shockwave of light through any image, or the layers beneath.

Code

The usage always matches the preview, layers and performance settings included. No build step or package.

Use as
Code view

Copy embed gives one block to paste into any page or site builder, no setup. For your own code: add drop-ripple.js, ittybitty-shader.js, runtime.js, pointer.js, texture.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="drop-ripple" style="width: 100%; aspect-ratio: 16 / 10;"></ittybitty-shader>

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

<script type="module">
  import { dropRipple } from './drop-ripple.js';

  const canvas = document.getElementById('drop-ripple');
  const effect = dropRipple(canvas, {
    showBloom: true,
    showRings: true,
    showFringe: true,
    image: '/examples/still-life.webp',
    origin: 'top',
    speed: 1,
    strength: 0.6,
    width: 0.5,
    glow: 0.7,
    every: 0,
    interactive: true,
    responsiveness: 0.5,
    light: '#ffffff',
    // Performance
    dpr: 2,
    adaptive: true,
  });

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

Details

A bright bloom flares where it starts; then a ring spreads across the picture, bending it like a wave through glass. The front shines and splits into colour at its edges, and weaker rings follow it, bending but not shining. Clicking sends a ripple out from wherever you click; set Every to have it ripple on a loop as well, from an edge or the middle.

Payload
7.2 KB brotli for drop-ripple.js and ittybitty-shader.js and runtime.js and pointer.js and texture.js, measured at build time. See the method.
Resolution
Device pixel ratio capped at 2.
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. Clicks still ripple 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.