Glow shader preview: Two soft lights drifting behind cards, product shots and pricing tables.
ittybitty

Glow

Two soft lights drifting behind cards, product shots and pricing tables.

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 glow.js, ittybitty-shader.js, runtime.js, 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="glow" style="width: 100%; height: 480px;"></ittybitty-shader>

<!-- Or with JavaScript, for full control: -->
<canvas id="glow" aria-hidden="true" style="width: 100%; height: 480px; display: block"></canvas>

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

  const canvas = document.getElementById('glow');
  const effect = glow(canvas, {
    showBackground: true,
    speed: 0.3,
    intensity: 0.85,
    size: 0.32,
    spread: 0.4,
    x: 0.5,
    y: 0.5,
    shape: 'orbs',
    interactive: true,
    responsiveness: 0.5,
    colorA: '#5b6cff',
    colorB: '#ff7a59',
    background: '#0d0d10',
    // Performance
    dpr: 1,
    adaptive: true,
  });

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

Details

A pair of coloured lights orbit slowly around a point you choose. They add together in linear light and roll off with a soft shoulder, so where they overlap they bloom rather than clip to a flat blob.

Payload
5.6 KB brotli for glow.js and ittybitty-shader.js and runtime.js and pointer.js, measured at build time. See the method.
Resolution
Device pixel ratio capped at 1. Glow has no fine detail to lose.
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 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.