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.

fix: give Fluid Simulation the same phone rule as the other pages, and correct its README's author and phone wording

matin7f871ec75a92
diff --git a/animations/06-3d-advanced/fluid-simulation/README.md b/animations/06-3d-advanced/fluid-simulation/README.md
index 54107422..d4bd43e5 100644
--- a/animations/06-3d-advanced/fluid-simulation/README.md
+++ b/animations/06-3d-advanced/fluid-simulation/README.md
@@ -62,9 +62,9 @@ vec2 ballPosition(int i, float t) {
| One blob follows the pointer | on | One blob leaves its path and sits under the pointer or a finger |
## Production notes
-- **Real fluid simulation**: Navier-Stokes-based fluid (velocity fields, pressure, diffusion) requires full-screen texture updates per frame. Pavel DoGreat's WebGL Fluid Simulation (open source) is the go-to — it renders truly interactive fluid at 60fps using a series of physics passes.
+- **Real fluid simulation**: Navier-Stokes-based fluid (velocity fields, pressure, diffusion) requires full-screen texture updates per frame. Pavel Dobryakov's WebGL Fluid Simulation (PavelDoGreat on GitHub, open source) is the go-to — it renders truly interactive fluid at 60fps using a series of physics passes.
- **SDF metaballs are an approximation**: they look fluid but don't conserve volume, don't flow around obstacles, and don't respond to physical forces. For true fluid behavior, use a full simulation library.
-- **Performance**: each additional metaball adds a distance evaluation per pixel. On a 1920×1080 canvas with 8 balls, that's ~16 million SDF evaluations per frame. This is why mobile frame rates drop — use a lower canvas resolution on mobile. The demo caps the backing store at 2× device pixel ratio on desktop and 1.5× under 600px, which is the whole of its quality/cost dial.
+- **Performance**: each additional metaball adds a distance evaluation per pixel. On a 1920×1080 canvas with 8 balls, that's ~16 million SDF evaluations per frame. This is why mobile frame rates drop — use a lower canvas resolution on mobile. The demo caps the backing store at 2× device pixel ratio on desktop and 1.5× on phones (600px wide or less, or 500px tall or less), which is the whole of its quality/cost dial.
- **Silent shader failure**: a shader that fails to compile throws nothing and logs nothing — you get a black canvas. Always check `COMPILE_STATUS` and `LINK_STATUS` and surface a message, as this demo does.
- **Context loss**: `webglcontextlost` fires on a GPU reset, a driver update, or a backgrounded tab being restored. Without a listener the canvas stays black permanently. Call `preventDefault()` on the loss event, stop the loop, and rebuild the program on `webglcontextrestored`.
- **Shadertoy**: the metaball pattern is one of the classic Shadertoy exercises. [shadertoy.com](https://www.shadertoy.com) has hundreds of metaball variants.
diff --git a/animations/06-3d-advanced/fluid-simulation/index.html b/animations/06-3d-advanced/fluid-simulation/index.html
index 7dea3568..b7ef2023 100644
--- a/animations/06-3d-advanced/fluid-simulation/index.html
+++ b/animations/06-3d-advanced/fluid-simulation/index.html
@@ -243,9 +243,9 @@ function init(){
}
function resize(){
- // Full DPR on desktop, capped lower on phones — every pixel costs one SDF
- // pass per metaball, so the backing store is the whole cost of this demo.
- const dpr=Math.min(window.devicePixelRatio||1,window.innerWidth<=600?1.5:2);
+ // Full DPR on desktop, capped lower on phones (600px wide or less, or 500px tall or less when held sideways) — every pixel costs
+ // one SDF pass per metaball, so the backing store is the whole cost of this demo.
+ const dpr=Math.min(window.devicePixelRatio||1,window.innerWidth<=600||window.innerHeight<=500?1.5:2);
W=cvs.width=Math.max(1,Math.round(stage.clientWidth*dpr));
H=cvs.height=Math.max(1,Math.round(stage.clientHeight*dpr));
if(!gl)return;
diff --git a/docs/superpowers/plans/2026-09-29-3d-content.md b/docs/superpowers/plans/2026-09-29-3d-content.md
index 0ca58a2a..b7759f46 100644
--- a/docs/superpowers/plans/2026-09-29-3d-content.md
+++ b/docs/superpowers/plans/2026-09-29-3d-content.md
@@ -468,7 +468,7 @@ None: leave out the `details.hb-options` block.
- **Reduced motion:** the page's reduced-motion branch (one still frame, paused) goes, and so does the rule `*{transition:none!important;animation:none!important}` (see the preamble).
- **Stage font:** no text on the stage; the WebGL message uses the site font.
- **Stage:** only the canvas; the fps badge goes and `.no-webgl` stays. `hb-dots`: no. Default height. `touch-action:pan-y` stays.
-- **Phone fallback:** today's stays: on screens 600px wide or less the canvas caps the pixel ratio at 1.5 (2 on computers), because every pixel measures its distance to every blob.
+- **Phone fallback:** today's stays: on phones (screens 600px wide or less, or 500px tall or less) the canvas caps the pixel ratio at 1.5 (2 on computers), because every pixel measures its distance to every blob. The height half is there so that a phone held sideways gets the same limit as on the other pages; the page used to look only at the width, and even then it measured 180 frames in 3 seconds sideways, so nothing was slow.
- **Touch:** `pointerdown` also sets the pointer's position, so a tap moves the pointer blob there and a sideways drag moves it along.
**Main settings**