
Lake
A still lake mirroring the sky and a far line of trees.
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 lake.js, ittybitty-shader.js, runtime.js, pointer.js, texture.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="lake" style="width: 100%; height: 560px;"></ittybitty-shader>
<!-- Or with JavaScript, for full control: -->
<canvas id="lake" aria-hidden="true" style="width: 100%; height: 560px; display: block"></canvas>
<script type="module">
import { lake } from './lake.js';
const canvas = document.getElementById('lake');
const effect = lake(canvas, {
showSky: true,
showSun: true,
showWater: true,
speed: 0.5,
zoom: 1,
ripples: 0.6,
streaks: 0.6,
mist: 0.35,
sun: 0.18,
shore: 'hills',
image: '',
shoreSize: 0.35,
interactive: true,
responsiveness: 0.5,
sky: '#3b5a8c',
horizon: '#f6c7a1',
land: '#1d2430',
water: '#1a2c3a',
// Performance
dpr: 2,
adaptive: true,
});
// Later: effect.set(…), effect.pause(), effect.resume(), effect.destroy()
</script>
Details
A calm lake at the edge of the day. The water mirrors a sky and a distant shore of hills and trees, broken by slow ripples and the darker streaks where wind touches the surface. Mist gathers on the far shore, the sun lays a path across the water, and the pointer drops ripples.
- Payload
- 7.7 KB brotli for lake.js and ittybitty-shader.js and runtime.js and pointer.js and texture.js, measured at build time. See the method.
- Resolution
- Device pixel ratio capped at 2. Adaptive resolution steps down on slow devices.
- 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.