
Sumi-e Mountains
Mountains in ink wash: ridge behind ridge, fading into mist.
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 sumi-e.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="sumi-e" style="width: 100%; aspect-ratio: 16 / 10;"></ittybitty-shader>
<!-- Or with JavaScript, for full control: -->
<canvas id="sumi-e" aria-hidden="true" style="width: 100%; aspect-ratio: 16 / 10; display: block"></canvas>
<script type="module">
import { sumiE } from './sumi-e.js';
const canvas = document.getElementById('sumi-e');
const effect = sumiE(canvas, {
showPaper: true,
showSun: true,
showMountains: true,
showMist: true,
speed: 0.2,
zoom: 1,
ranges: 5,
height: 0.6,
mist: 0.6,
brush: 0.5,
ink: '#1c1c22',
paper: '#f1ebdf',
accent: '#c8372d',
// Performance
dpr: 2,
adaptive: true,
});
// Later: effect.set(…), effect.pause(), effect.resume(), effect.destroy()
</script>
Details
Each range is a single wash of diluted ink, darkest along its crest and bleeding softly down into paler ink, and paler still the further it recedes. The dry edge of the brush breaks along the ridgelines, mist fills the valleys, and the ranges drift past at their own depths. Painted on paper, with a pale sun.
- Payload
- 5.5 KB brotli for sumi-e.js and ittybitty-shader.js and runtime.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.