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: review fixes in five READMEs: no CSS mesh() spec exists yet, the demo's own will-change, Bootstrap's and glslCanvas's real setup, what a negative delay fixes, and canceled

matin565041ec8741
diff --git a/animations/01-scroll-based/scrollspy-nav/README.md b/animations/01-scroll-based/scrollspy-nav/README.md
index 29937b66..271dc26f 100644
--- a/animations/01-scroll-based/scrollspy-nav/README.md
+++ b/animations/01-scroll-based/scrollspy-nav/README.md
@@ -57,7 +57,7 @@ The menu sits inside the scroller, in a row that is zero tall and `position: sti
- **Suppress spy updates during programmatic scroll.** A smooth scroll from section 1 to section 5 passes through 2, 3, and 4; without a lock the indicator rapid-fires across every link in between. Activate the target immediately, ignore spy results until the scroll settles, then resume.
- **IntersectionObserver is not a drop-in replacement.** It tells you which sections intersect a band, but scrollspy needs *exactly one* active section at all times — sections taller than the viewport report no intersection with a thin band unless you observe carefully-tuned `rootMargin` bands, and ties between two intersecting sections still need a scroll-position tiebreak. For "one active link" semantics, the cached-tops comparison is simpler and deterministic.
- **Using native anchors instead?** If you link with `href="#section"` and let the browser jump, set `scroll-margin-top` on the targets so a fixed header does not cover the section heading, and use `scroll-behavior: smooth` on the scroller.
-- **Libraries**: Bootstrap's Scrollspy highlights the link of the section in view once `data-bs-spy="scroll"` is on the scroll container, and Gumshoe is a small standalone script that does the same.
+- **Libraries**: Bootstrap's Scrollspy highlights the link of the section in view once the scroll container has `data-bs-spy="scroll"` and a `data-bs-target` naming the menu, and Gumshoe is a small standalone script that does the same.
## See also
diff --git a/animations/05-text-typography/text-morphing/README.md b/animations/05-text-typography/text-morphing/README.md
index 9753eca1..b01cba25 100644
--- a/animations/05-text-typography/text-morphing/README.md
+++ b/animations/05-text-typography/text-morphing/README.md
@@ -74,7 +74,7 @@ function afterExit() {
## Production notes
- **Length mismatch**: this demo sidesteps it — the whole old word leaves before the new one arrives, so words of any length work. A morph that swaps letters in place has to fade the extra letters in or out with opacity only, so the letters around them do not jump.
- **Fixed-width container**: to prevent layout shift as word length changes, give the rotating word container a fixed or `min-width` based on the longest word. Otherwise sibling elements jump as words swap.
-- **`will-change: transform`**: only add this during active morphing — set it at the start of a transition and remove it after. Persistent `will-change` on many small spans wastes GPU memory.
+- **`will-change`**: the demo sets `will-change: transform, opacity` on its letters in the stylesheet, which costs little for one short word whose spans are rebuilt at every change. With many letters on screen, add it just before a change and remove it after, because each promoted span keeps its own layer in GPU memory.
- **GSAP**: `gsap.to(chars, { y: -50, opacity: 0, stagger: 0.03, duration: 0.4 })` for exits, then rebuild and animate in. GSAP's stagger model is cleaner than per-element `transitionDelay` in JavaScript.
- **SplitType**: a lightweight library that splits text into `<div>` wrappers per word/char without the overhead of GSAP. Pairs well with this pattern.
diff --git a/animations/07-ambient-background/matrix-rain/README.md b/animations/07-ambient-background/matrix-rain/README.md
index 9670e75c..b425eac8 100644
--- a/animations/07-ambient-background/matrix-rain/README.md
+++ b/animations/07-ambient-background/matrix-rain/README.md
@@ -43,7 +43,7 @@ Because the canvas is never fully cleared, the length of the tail is entirely co
## Production notes
- **`fillRect` fade vs `clearRect`**: clearing the canvas each frame gives no trail — you would have to store and redraw every past glyph yourself. Painting a translucent `fillRect` is both the trail mechanism and cheaper, since it is one composited rectangle instead of hundreds of retained cells.
- **Cap density on mobile**: column count is derived from a minimum pixel pitch, not an unbounded `width / fontSize`. Combined with clamping `devicePixelRatio` to 2, this keeps the per-frame `fillText` count bounded so the effect holds 60fps on mid-range phones. Heavy `shadowBlur` is the most expensive part — it is applied only to the single leader glyph, never the trail.
-- **Pause on hidden tab**: the `requestAnimationFrame` loop is cancelled on `visibilitychange` when `document.hidden` is true and restarted when the tab returns, so a background tab burns no CPU or battery.
+- **Pause on hidden tab**: the `requestAnimationFrame` loop is canceled on `visibilitychange` when `document.hidden` is true and restarted when the tab returns, so a background tab burns no CPU or battery.
- **Reduced motion**: the demo starts paused, showing a screen of rain drawn at once, until the visitor presses Play. In production, show these visitors a still frame.
- **It is decorative**: real usage should sit behind content with `aria-hidden="true"`, `pointer-events: none`, and enough contrast on the foreground text that the rain does not reduce readability. Treat it as texture, not information.
- **No library needed**: a 2D canvas, `fillText` and a translucent `fillRect` are the whole effect.
diff --git a/animations/07-ambient-background/mesh-gradient/README.md b/animations/07-ambient-background/mesh-gradient/README.md
index 2bb13967..a8e59b5a 100644
--- a/animations/07-ambient-background/mesh-gradient/README.md
+++ b/animations/07-ambient-background/mesh-gradient/README.md
@@ -12,7 +12,7 @@ A mesh gradient is a background of a few large circles of color, blurred so thei
- App splash screens and loading states
## How it works
-Each blob is an absolutely-positioned round `<div>` filled with one color and softened with `filter: blur()`. The key is heavy blur — 80px or more — which dissolves the circle's hard edge into a wash of color. Each blob has keyframes of its own, a single move from where it starts to where it ends, played forward and back (`alternate`) over its own share of `--dur`, the Speed setting:
+Each blob is an absolutely-positioned round `<div>` filled with one color and softened with `filter: blur()`. The key is heavy blur — 80px or more — which dissolves the circle's hard edge into a wash of color. Each blob has keyframes of its own, a single move from where it starts to where it ends, played forward and back (`alternate`) over its own multiple of `--dur`, the Speed setting:
```css
.blob {
@@ -74,9 +74,9 @@ Heavy blur is the costly part on phones, so the demo halves it on small screens:
## Production notes
- **`filter: blur()` on GPU**: heavy blur is GPU-accelerated in modern browsers but creates a compositing layer per blurred element. Four blurred blobs = four compositing layers. On low-RAM devices, this stacks up — test on mobile.
- **Overflow clipping**: blobs extend beyond the container. Always `overflow: hidden` on the parent so blobs don't bleed into the rest of the page.
-- **Native CSS mesh gradients**: the CSS Working Group has a `mesh()` function specification in progress that would render true mesh gradients in CSS without the blur trick. It is not yet shipped in any browser.
+- **Native CSS mesh gradients**: CSS has none yet. A proposal for mesh and freeform gradients is open at the CSS Working Group (csswg-drafts issue #7648), but it is not in any specification and no browser ships it, so blurred blobs remain the way to get this look.
- **Figma / Sketch "mesh gradient" tools**: design tools generate mesh gradients as images. For web, the blur-div approach produces a similar aesthetic with full animation capability.
-- **Keep the blobs out of step**: if every blob shares one duration and starts with the others, they all turn around at the same moment and the same mix comes back every cycle. The demo gives each blob its own path and its own duration instead. A negative `animation-delay` (e.g., `-10s`) is another way: it starts an animation mid-cycle, so blobs that share a duration still never line up.
+- **Keep the blobs out of step**: if every blob shares one duration and starts with the others, they all turn around at the same moment and the same mix comes back every cycle. The demo gives each blob its own path and its own duration instead. A negative `animation-delay` (e.g., `-10s`) starts an animation mid-cycle, so blobs that share a duration no longer turn around together, though the whole mix still repeats every cycle.
- **Libraries**: Paper Shaders has a `MeshGradient` that draws the colors in a shader instead of with blurred circles, animated by a speed setting, in plain JavaScript or as a React component.
## See also
diff --git a/animations/07-ambient-background/plasma/README.md b/animations/07-ambient-background/plasma/README.md
index 9dbf04ed..e067a705 100644
--- a/animations/07-ambient-background/plasma/README.md
+++ b/animations/07-ambient-background/plasma/README.md
@@ -74,8 +74,9 @@ math.
- For the real thing, move the sum-of-sines into a WebGL fragment shader. The GPU
runs it per pixel at full resolution for free, and you drop the upscale entirely.
- No library is needed for this canvas version. For the shader version, glslCanvas
- runs a fragment shader in a `<canvas>` from one `data-fragment-url` attribute,
- and three.js does the same with a `ShaderMaterial` on a full-screen plane.
+ runs a fragment shader in a `<canvas class="glslCanvas">` from its
+ `data-fragment-url` attribute, and three.js does the same with a
+ `ShaderMaterial` on a full-screen plane.
## See also