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: correct the Image Distortion README's fade figure and CLAMP_TO_EDGE name, and the sheet's rest-difference maxima

matindb623641f65e
diff --git a/animations/06-3d-advanced/image-distortion-hover/README.md b/animations/06-3d-advanced/image-distortion-hover/README.md
index 8d364db7..268b2adb 100644
--- a/animations/06-3d-advanced/image-distortion-hover/README.md
+++ b/animations/06-3d-advanced/image-distortion-hover/README.md
@@ -58,12 +58,12 @@ In the demo the pattern stands still, as a real image would: its time value stay
| Effect | Ripple | Ripple sends rings out from the pointer; Push bulges the picture outward; Liquid swirls it; Pixels breaks it into squares |
| Strength | Medium | How far the picture bends: gentle is 4, medium 8 and strong 14; stronger looks more dramatic but harder to read |
| Size | Medium | How wide an area bends: small is 15%, medium 25% and large 40% of the picture's height |
-| Fade-out speed | Normal | How fast the bending fades after the pointer leaves: each second it loses about three fifths of its strength at slow, three quarters at normal and nine tenths at fast |
+| Fade-out speed | Normal | How fast the bending fades after the pointer leaves: each second it loses about three fifths of its strength at slow, about four fifths at normal and nine tenths at fast |
| Moving ripples | on | With Ripple, the rings keep moving outward while the pointer rests; off, they stand still |
## Production notes
- **Real images**: replace the procedural `pattern()` function with `texture2D(uTexture, distortedUV)`. Load images into WebGL via `gl.texImage2D()` from an `<img>` or `ImageBitmap`. Same-origin policy applies — external image URLs need CORS headers.
-- **`gl.clampToEdge`**: ensure texture wrap mode is `CLAMP_TO_EDGE` so UV values outside [0,1] don't tile or mirror at the image border when distortion pushes UVs out of range.
+- **`CLAMP_TO_EDGE`**: set the texture's wrap mode to `gl.CLAMP_TO_EDGE` (both `TEXTURE_WRAP_S` and `TEXTURE_WRAP_T`) so UV values outside [0,1] don't tile or mirror at the image border when distortion pushes UVs out of range.
- **Pointer, not mouse**: bind `pointermove`/`pointerdown` rather than `mousemove`, or the effect never fires on a phone. The cursor position must be converted to backing-store pixels (multiply by the device pixel ratio used for the canvas) before it reaches the shader, or the distortion centre drifts away from the finger on high-DPI screens.
- **Backing store and DPR**: size the canvas to `clientWidth * dpr` and call `gl.viewport()` after every resize. Uncapped DPR is expensive for a fullscreen fragment shader — this demo caps it at 2, and at 1.5 on phones. Resizing clears the drawing buffer, so a demo that is not drawing every frame (this one stops at rest) has to repaint after a resize or it goes black.
- **Context loss**: a GPU reset or a restored tab fires `webglcontextlost`. Without a listener (and a `preventDefault()` so `webglcontextrestored` follows) the canvas dies permanently. Shaders, buffers and uniform locations all have to be rebuilt on restore.
diff --git a/docs/superpowers/plans/2026-09-29-3d-content.md b/docs/superpowers/plans/2026-09-29-3d-content.md
index b8104452..40901c43 100644
--- a/docs/superpowers/plans/2026-09-29-3d-content.md
+++ b/docs/superpowers/plans/2026-09-29-3d-content.md
@@ -1192,7 +1192,7 @@ None: leave out the `details.hb-options` block.
- **The render loop runs only while something moves.** After drawing a frame, `render()` requests the next one only while the pointer is on the picture (`active`), the distortion is still fading (`amp > 0`) or a Show me run is under way (`demoStart` set); otherwise it sets `raf = null` and stops, so a picture at rest is not redrawn 60 times a second. A frame skipped by today's 15ms gate still requests the next one. `wake()` starts the loop again when it has stopped (it sets `lastT` and `startT` to `performance.now()`, so `phase` does not jump, then requests a frame); `track()` and Show me call it.
- **The first picture:** `draw()` at load. While the loop is stopped, a resize and every setting call `draw()` once (a resize clears the canvas).
- **The picture stands still:** the shader's `uT` stays 0. Today the pattern drifts slowly by itself; a real image would not, and a do-it page moves only when the visitor or Show me moves it.
- - `phase` and the fade (`amp`) run as today while the loop runs, with one change: the fade ends, and the loop stops, when `amp` falls below `.01` (today `.005`), about half a second sooner. The last frame then differs from the picture at rest by at most 6 (of 255) in any pixel at the default settings, and by at most 18 at any strength and size with Ripple, Push or Liquid; Pixels changes by about 30 in a few pixels, as it did with `.005`, because its cell size settles to its rest value at any strength.
+ - `phase` and the fade (`amp`) run as today while the loop runs, with one change: the fade ends, and the loop stops, when `amp` falls below `.01` (today `.005`), about half a second sooner. The last frame then differs from the picture at rest by at most 7 (of 255) in any pixel at the default settings, and by at most 19 at any strength and size with Ripple, Push or Liquid; Pixels changes by about 30 in a few pixels, as it did with `.005`, because its cell size settles to its rest value at any strength.
- **The fade is quicker than today's.** Today's default (Decay Speed 5, `DECAY` 0.5) took about 10.5 seconds to stop after the pointer let go, so a Show me run (3 seconds) was not back at rest until about 13.5 seconds after the press, against the "2.5 to 3 seconds ... returns the demo to rest" above, and the browser check (which looks for a still stage about 4.5 seconds after the arrival run) failed. Fade-out speed is now Slow · Normal · Fast = `DECAY` 0.9 / 1.5 / 2.4, and the default is 1.5. The fade law (`amp *= 1 - DECAY*dt/1000`) is unchanged. The loop now stops about 5, 3 and 2 seconds after the pointer lets go, so at Normal the picture is at rest about 6 seconds after Show me is pressed, and at Medium strength the last half second of the fade is under a pixel of movement.
- **Reduced motion:** the page's reduced-motion branch goes. With the picture still, nothing on the stage moves until the visitor or Show me does.
- **Stage font:** no text on the stage; `.fallback` uses the site font.
@@ -1240,7 +1240,7 @@ None: leave out the `details.hb-options` block.
| Effect | Ripple | Ripple sends rings out from the pointer; Push bulges the picture outward; Liquid swirls it; Pixels breaks it into squares |
| Strength | Medium | How far the picture bends: gentle is 4, medium 8 and strong 14; stronger looks more dramatic but harder to read |
| Size | Medium | How wide an area bends: small is 15%, medium 25% and large 40% of the picture's height |
- | Fade-out speed | Normal | How fast the bending fades after the pointer leaves: each second it loses about three fifths of its strength at slow, three quarters at normal and nine tenths at fast |
+ | Fade-out speed | Normal | How fast the bending fades after the pointer leaves: each second it loses about three fifths of its strength at slow, about four fifths at normal and nine tenths at fast |
| Moving ripples | on | With Ripple, the rings keep moving outward while the pointer rests; off, they stand still |
- **README See also:**