Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

docs: bring the WebGL Shader Animation and Noise-Based Motion sheet sections in line with the fixes

matin12f364bf3f34
diff --git a/docs/superpowers/plans/2026-09-29-3d-content.md b/docs/superpowers/plans/2026-09-29-3d-content.md
index a650fdaa..c64b2f43 100644
--- a/docs/superpowers/plans/2026-09-29-3d-content.md
+++ b/docs/superpowers/plans/2026-09-29-3d-content.md
@@ -606,23 +606,24 @@ None: leave out the `details.hb-options` block.
- **Description:** Moving color patterns computed for every pixel. Best for bold backgrounds.
- **Watch it help line:** default
- **Player bar:** Pause (page) · Slow motion (page)
-- **Sequence:** the WebGL loop as in the preamble (`render(ts)`, 16ms gate). Each drawn frame adds the frame's time × Speed to `T` (at most 100ms, as today) and calls `draw()`.
+- **Sequence:** the WebGL loop as in the preamble (`render(ts)`, 16ms gate). Each drawn frame adds the frame's time × Speed to `T` (at most 100ms, as today), sets `SHOWN_UV=MOUSE_UV` (see Touch and pointer) and calls `draw()`.
- **The first picture:** `draw()` runs once at load, after `resize()` (today `still()` draws only while paused).
- **Pause:** on `hb:pause`, `setPaused(e.detail.paused)` (today's function, without the button label): it cancels the frame and redraws the held frame, or starts the loop.
- - **While paused,** settings call `still()`, as today.
+ - **While paused,** settings call `still()`, as today, and so does a resize.
+ - **A failed build:** `switchShader` stops the loop when a pattern's shader does not build, and shows the message. Picking a pattern that builds hides the message and, unless the page is paused, starts the loop again: the Pattern handler calls `still()` while paused and `start()` otherwise (`start()` does nothing while the loop runs). Before, the loop stayed stopped although the button still said Pause. After `webglcontextrestored` the page calls `init()` and `resize()` and no `clearFail()` of its own, so the message stays when the restored shader does not build; `switchShader` clears it when the shader does.
- The "WebGL is not available" branch keeps `fail()`; the line that disabled the panel's controls goes (the settings then change nothing, which the message explains).
- **Slow motion:** while the switch is on, `T` adds a third: `T += Math.min(dt,100)/1000*SPD/3`, from the next frame.
- **Reduced motion:** the page's `setPaused(true)` at load goes (see the preamble).
- **Stage font:** no text on the stage; `.gl-msg` uses the site font.
- **Stage:** only the canvas. The fps and pattern-name badges (`.overlay`) and the shader source panel go; `.gl-msg` stays. `hb-dots`: no. Default height. `touch-action:pan-y` stays.
- **Phone fallback:** today's stays: the pixel ratio is capped at 1.5 on phones (2 on computers).
-- **Touch and pointer:** `pointerdown` also sets the pointer's position, so with Reacts to the pointer a tap bends the pattern there. The `pointermove` and `pointerdown` handlers only record `MOUSE_UV`: today's `still()` call in the `pointermove` handler goes, so a paused pattern does not bend under a moving pointer (the preamble's rule). The new position shows at the next Play or setting change.
+- **Touch and pointer:** `pointerdown` also sets the pointer's position, so with Reacts to the pointer a tap bends the pattern there. The `pointermove` and `pointerdown` handlers only record `MOUSE_UV`: today's `still()` call in the `pointermove` handler goes, so a paused pattern does not bend under a moving pointer (the preamble's rule). The picture takes the pointer only from a frame that moves on, as Fluid / Liquid Simulation does: `render()` sets `SHOWN_UV=MOUSE_UV` (it starts at the middle, `[.5,.5]`) just before `draw()`, and `draw()` sends `SHOWN_UV` to the shader. A repaint while paused (a setting change or a resize) therefore shows the new setting and nothing else: a paused Plasma to Waves to Plasma round trip changes 0 pixels, where it changed 99% of the stage when the repaint took the pointer recorded since pausing. The new position shows at the next Play. With Plasma the middle looks the same as no pointer, so switching Reacts to the pointer on while paused shows nothing until Play; Waves, Cells and Kaleidoscope show their bump or slices at the middle.
**Main settings**
| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
|---|---|---|---|---|---|
-| Pattern | Choice buttons | Plasma · Waves · Cells · Kaleidoscope | Plasma | Four patterns, each one short formula. | `switchShader(0 / 1 / 2 / 3)`, then `still()` |
+| Pattern | Choice buttons | Plasma · Waves · Cells · Kaleidoscope | Plasma | Four patterns, each one short formula. | `switchShader(0 / 1 / 2 / 3)`, then `still()` while paused or `start()` otherwise |
| Speed | Choice buttons | Slow · Normal · Fast | Normal | How fast the pattern moves. | `SPD`: 0.6 / 1 / 1.6 |
**More options**
@@ -674,7 +675,7 @@ None: leave out the `details.hb-options` block.
}
```
- The rest is unchanged.
+ The Plasma and Cells snippets did not match the demo and are brought in line with it. Plasma gets `uv.x *= uRes.x / uRes.y;`, `uT * 0.5` in the third sine, `sin(length(uv) * 6.0)` and the colour `float hue = fract(v * 0.25 + uT * 0.05); gl_FragColor = vec4(hsv(hue, 0.9, 0.95), 1.0);` in place of the cosine palette, and its lead-in says the sum picks a hue (`hsv()` turns a hue, a saturation and a brightness into a color). The second snippet is headed "Cells (Voronoi)" and its point is `rand2(i + n + uT * 0.01)`, which moves with time. The rest is unchanged.
- **README Production notes:** unchanged
- **Category line:** `06.07 · 3D & Advanced`
- **Pager:** Previous: Glassmorphism Animated (`../glassmorphism-animated/`) · Next: Noise-Based Motion (`../noise-based-motion/`)
@@ -690,6 +691,7 @@ None: leave out the `details.hb-options` block.
- **Sequence:** the canvas loop as in the preamble (`loop(ts)`, 16ms gate). Each drawn frame adds Speed × 0.01 to `t` and draws with `frame()`.
- **The dot spacing:** `drawGrid()` uses `SPACE` pixels as its step, in place of `Math.max(4,Math.floor(W/GRID))`. Today the grid is set by columns across the stage, so a narrow phone stage gets a finer grid and more dots than a laptop (340 dots on a phone stage against 160 on the stage of a 1280×800 screen). Spacing in pixels keeps the same look on every screen: Medium, 48px, is today's 20 columns on a 960px laptop stage.
- **The first picture:** `frame()` runs at load. **While paused,** every setting (Try it's `click` and `change`, in place of today's `aside` listener) and a resize call `frame()`.
+ - **The blob ripples.** The edge reads the noise along a circle of radius `RING × SCALE` with `RING = 48`, and the inner ring along `RING_IN × SCALE` with `RING_IN = 32`, in place of today's 12 and 8. Today's circle was so small that the noise hardly varied along it: at the default the edge departed only 12px from round (median, on a 106px radius, with one lobe) while the whole blob breathed 39px (86 to 125px), so it read as a breathing circle, not the ripple the Description and the prompt promise. Measured on the page over 120s of noise (the drawn outline, largest minus smallest radius): before, 11.5px median, 1.1 lobes; now, at the default settings, 33px median (25 to 41px from the 10th to the 90th percentile, 44px at most), about two lobes (2.3), and the whole blob breathes 20px (96 to 115px). The choices stay meaningful: Pattern size Large 23px and 1.4 lobes, Medium 33px and 2.3, Small 37px and 4.4 (busy); Wobble Small 16px, Medium 33px, Large 55px (73px at most). The largest ripple (Large wobble, Small pattern size) stays inside the canvas on the 286×298, 341×298, 745×258 and 958×378 stages. The dots are untouched.
- **Slow motion:** while the switch is on, each drawn frame adds a third: `t += SPD*.01/3`, from the next frame.
- **Reduced motion:** the page's reduced-motion branch goes (see the preamble).
- **Stage font:** no text on the stage.
@@ -745,7 +747,7 @@ None: leave out the `details.hb-options` block.
- [Canvas Particle Effect](../canvas-particle-effect/) — dots moved by simple physics instead of noise
- [Flow Field](../../07-ambient-background/flow-field/) — particles follow a noise field and leave trails
- [Volumetric Smoke / 3D Noise](../volumetric-smoke/) — the same kind of noise, in 3D, drawn as smoke
-- **README How it works:** unchanged, plus one sentence after the wind-field snippet: "The demo sets `step` as a spacing in pixels rather than a number of columns, so a phone's smaller stage draws fewer dots at the same spacing."
+- **README How it works:** unchanged, plus one sentence after the wind-field snippet: "The demo sets `step` as a spacing in pixels rather than a number of columns, so a phone's smaller stage draws fewer dots at the same spacing." The Blob snippet reads `48 * SCALE` where it read `12 * SCALE`, with one sentence after it: "The noise is read along a circle of radius `48 * SCALE`. A tiny circle would see almost one value, so the whole edge would only swell and shrink together; this one spans about two bumps of noise at the default size, so the edge ripples."
- **README Production notes:** unchanged
- **Category line:** `06.08 · 3D & Advanced`
- **Pager:** Previous: WebGL Shader Animation (`../webgl-shader-animation/`) · Next: SVG Path Animation (`../svg-path-animation/`)