
Ship something
people remember.
A button that wakes up when you reach for it.
ittybitty
Wrap
Heat through a false-colour camera: rings, streaks and rainbow bands in moving film grain.
This browser cannot run WebGL2, so this is a still image. The code below works wherever WebGL2 is available.
Code
For your own build, add wrap.js, ittybitty-shader.js and 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="wrap" style="width: 100%; height: 480px;"></ittybitty-shader>
<!-- Or with JavaScript, for full control: -->
<canvas id="wrap" aria-hidden="true" style="width: 100%; height: 480px; display: block"></canvas>
<script type="module">
import { wrap } from './wrap.js';
const canvas = document.getElementById('wrap');
const effect = wrap(canvas, {
look: 'arcs',
palette: 'violet',
colors: [[0, '#1c1c1c'], [0.3, '#4d44c4'], [0.5, '#6aa0b0'], [0.7, '#557a1c'], [1, '#c2efe4']],
speed: 1,
heat: 1,
scale: 1,
turn: 0,
warp: 0,
grain: 1,
mirror: true,
// Performance
dpr: 2,
adaptive: true,
});
// Later: effect.set(…), effect.pause(), effect.resume(), effect.destroy()
</script>
Details
A smooth field of heat rises from the edges, as rings, soft diagonal streaks or broad rainbow bands, and every level of heat has its own colour, so each ripple turns into a run of violet and olive, lime, red and cyan, or a full spectrum. Grey film grain moves over it. A year-in-review look for recaps, stories and launch pages.
- Payload
- 9.1 KB brotli for wrap.js, ittybitty-shader.js and runtime.js, measured at build time.
- Resolution
- Device pixel ratio capped at 2 for crisp grain; heat is worked out on a 330-row grid and filtered up, so the cost barely grows with size.
- 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.
- Source
- wrap.js on GitHub, in a public repo that logs every change.