
Edge Glow
Flowing colour that hugs the edges, like an assistant listening.
This browser cannot run WebGL2, so this is a still image. The code below works wherever WebGL2 is available.
Code
The usage always matches the preview, layers and performance settings included. No build step or package.
Copy embed gives one block to paste into any page or site builder, no setup. For your own code: add edge-glow.js, ittybitty-shader.js, runtime.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="edge-glow" style="width: 100%; aspect-ratio: 16 / 10;"></ittybitty-shader>
<!-- Or with JavaScript, for full control: -->
<canvas id="edge-glow" aria-hidden="true" style="width: 100%; aspect-ratio: 16 / 10; display: block"></canvas>
<script type="module">
import { edgeGlow } from './edge-glow.js';
const canvas = document.getElementById('edge-glow');
const effect = edgeGlow(canvas, {
showRim: true,
showHaze: true,
showWake: true,
speed: 1,
width: 16,
intensity: 1,
radius: 48,
listen: 0.6,
wake: 6,
from: 'right',
colourA: '#ff5a2e',
colourB: '#ff3fa4',
colourC: '#b04dff',
colourD: '#4f78ff',
// Performance
dpr: 1,
adaptive: true,
});
// Later: effect.set(…), effect.pause(), effect.resume(), effect.destroy()
</script>
Details
A band of vivid, flowing colour round the edges of the canvas: a thin bright rim, a band of colour in shifting patches and hot spots, and a haze that bleeds inward. It swells unevenly as if hearing a voice, and when it wakes a wave of light sweeps in from one side. The middle stays clear, so it sits over any page.
- Payload
- 5.8 KB brotli for edge-glow.js and ittybitty-shader.js and runtime.js, measured at build time. See the method.
- Resolution
- Device pixel ratio capped at 1: the glow is soft, so it needs no more.
- 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.