
Wagara
Traditional Japanese patterns, crisp at any size, with light travelling across them.
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 wagara.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="wagara" style="width: 100%; aspect-ratio: 16 / 10;"></ittybitty-shader>
<!-- Or with JavaScript, for full control: -->
<canvas id="wagara" aria-hidden="true" style="width: 100%; aspect-ratio: 16 / 10; display: block"></canvas>
<script type="module">
import { wagara } from './wagara.js';
const canvas = document.getElementById('wagara');
const effect = wagara(canvas, {
showBackground: true,
pattern: 'seigaiha',
speed: 0.4,
scale: 1,
weight: 0.5,
shimmer: 0.6,
interactive: true,
responsiveness: 0.5,
ground: '#1b2a4a',
line: '#e9dcc0',
highlight: '#ffd88a',
// Performance
dpr: 2,
adaptive: true,
});
// Later: effect.set(…), effect.pause(), effect.resume(), effect.destroy()
</script>
Details
Seigaiha (waves of the blue sea), asanoha (hemp leaf), shippō (seven treasures) and kikkō (tortoiseshell), drawn exactly at any size. A slow band of light drifts across them like a sheen over woven silk or gold leaf, and the pointer lifts them into a glow. Perfect behind a heading or across a section.
- Payload
- 6.2 KB brotli for wagara.js and ittybitty-shader.js and runtime.js and pointer.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. 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.