Bubbly Clouds shader preview: Puffy cartoon clouds in a bright blue sky, drifting past, receding, or flying through.
ittybitty

Bubbly Clouds

Puffy cartoon clouds in a bright blue sky, drifting past, receding, or flying through.

Code

The usage always matches the preview, layers and performance settings included. No build step or package.

Use as
Code view

Copy embed gives one block to paste into any page or site builder, no setup. For your own code: add bubbly-clouds.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="bubbly-clouds" style="width: 100%; aspect-ratio: 16 / 10;"></ittybitty-shader>

<!-- Or with JavaScript, for full control: -->
<canvas id="bubbly-clouds" aria-hidden="true" style="width: 100%; aspect-ratio: 16 / 10; display: block"></canvas>

<script type="module">
  import { bubblyClouds } from './bubbly-clouds.js';

  const canvas = document.getElementById('bubbly-clouds');
  const effect = bubblyClouds(canvas, {
    showShading: true,
    showSky: true,
    showClouds: true,
    view: 'side',
    speed: 0.4,
    count: 8,
    size: 1,
    bubbles: 0.6,
    softness: 0.5,
    farShade: 0,
    outline: 0,
    top: '#2f7fe4',
    horizon: '#a8d8ff',
    cloud: '#ffffff',
    shade: '#a9c4ec',
    line: '#3d5f9e',
    // Performance
    dpr: 2,
    adaptive: true,
  });

  // Later: effect.set(…), effect.pause(), effect.resume(), effect.destroy()
</script>

Details

Clouds drawn the way a cartoonist draws them: a flat base under a scalloped row of round puffs, flat white with a soft blue belly where each puff bulges away from the sun. Crisp cel shading or soft and painted, with an optional inked outline. Watch them drift past side-on, recede to the horizon, or fly straight through them, as in a certain opening sequence.

Payload
6.0 KB brotli for bubbly-clouds.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.