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.
HTML ai-promptsanimationcss-animationsfrontendgithub-pagesjavascriptmicrointeractionsmotion-designno-dependenciesreferencescroll-animationui-animationweb-animationweb-developmentwebgl
feat: Water Ripple (06.27), a new 3D & Advanced page
matin878cd070a204
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.ymlindex 103476ac..f53f4d2b 100644--- a/.github/ISSUE_TEMPLATE/config.yml+++ b/.github/ISSUE_TEMPLATE/config.yml@@ -5,7 +5,7 @@ contact_links:about: "Saw an animation on a website and don't know its name? Answer three short questions and see the ones that match."- name: Browse the live handbookurl: https://matinmonshizadeh.github.io/animation-handbook/- about: See all 171 techniques running before filing an issue.+ about: See all 172 techniques running before filing an issue.- name: Ask a question or share an ideaurl: https://github.com/matinmonshizadeh/animation-handbook/discussionsabout: Questions, ideas and things you made with the handbook go to Discussions.diff --git a/404.html b/404.htmlindex ed9d3a77..694da1db 100644--- a/404.html+++ b/404.html@@ -133,7 +133,7 @@ button,input{font:inherit;color:inherit}</form><nav class="ways" aria-label="Ways back"><a class="way" href="/animation-handbook/">Go to the home page</a>- <a class="way" href="/animation-handbook/?view=all#results">Browse all 171 animations</a>+ <a class="way" href="/animation-handbook/?view=all#results">Browse all 172 animations</a><a class="way" href="/animation-handbook/?view=find">Find an animation by what you saw</a></nav></main>diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 86cc1f90..8de7e250 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -25,6 +25,8 @@ The main steps of Animation Handbook, newest first, with the number of animationand Compare from the start.- A new animation, Card Deck Swipe (171 in all): swipe the top card left or right and the next one rises, with See insideand Compare from the start.+- A new animation, Water Ripple (172 in all): ripples spread from your finger and bend the picture below, with See inside+ and Compare from the start.## 1.0.0 — 2026-10-10diff --git a/README.md b/README.mdindex a8d1dfde..2eaae339 100644--- a/README.md+++ b/README.md@@ -1,10 +1,10 @@<div align="center">-<a href="https://matinmonshizadeh.github.io/animation-handbook/"><picture><source media="(prefers-reduced-motion: reduce) and (max-width: 600px)" srcset="docs/hero-phone-still.webp"><source media="(prefers-reduced-motion: reduce)" srcset="docs/hero-still.webp"><source media="(max-width: 600px)" srcset="docs/hero-phone.webp"><img src="docs/hero.webp" alt="Six animations from the handbook playing at once: Text Particles, Synthwave Grid, Liquid Glass, Shatter Effect, Holographic Card, and Dynamic Island, six of its 171 web animation techniques" width="820"></picture></a>+<a href="https://matinmonshizadeh.github.io/animation-handbook/"><picture><source media="(prefers-reduced-motion: reduce) and (max-width: 600px)" srcset="docs/hero-phone-still.webp"><source media="(prefers-reduced-motion: reduce)" srcset="docs/hero-still.webp"><source media="(max-width: 600px)" srcset="docs/hero-phone.webp"><img src="docs/hero.webp" alt="Six animations from the handbook playing at once: Text Particles, Synthwave Grid, Liquid Glass, Shatter Effect, Holographic Card, and Dynamic Island, six of its 172 web animation techniques" width="820"></picture></a># Animation Handbook-**A visual reference of 171 web animation techniques: watch each one play live, change most of them with plain settings, and copy a ready-made prompt for your AI assistant. Free to use, with no sign-up.**+**A visual reference of 172 web animation techniques: watch each one play live, change most of them with plain settings, and copy a ready-made prompt for your AI assistant. Free to use, with no sign-up.**[**Open the live handbook →**](https://matinmonshizadeh.github.io/animation-handbook/)@@ -14,7 +14,7 @@ Add it to your AI coding assistant (run in your project folder; needs Node.js):npx skills add matinmonshizadeh/animation-handbook```-[](https://matinmonshizadeh.github.io/animation-handbook/) [](https://github.com/matinmonshizadeh/animation-handbook) [](LICENSE) [](#full-catalog) [](#design-principles) [](#design-principles)+[](https://matinmonshizadeh.github.io/animation-handbook/) [](https://github.com/matinmonshizadeh/animation-handbook) [](LICENSE) [](#full-catalog) [](#design-principles) [](#design-principles)</div>@@ -22,7 +22,7 @@ npx skills add matinmonshizadeh/animation-handbook## What this is-Here are 171 web animation techniques in one place, each shown working. Every page plays its animation live and gives you a ready-made prompt to paste into your AI assistant, so you can add the animation to your own site without writing the code yourself. Most pages also let you change the animation with a few plain settings, and the prompt you copy lists your choices. Each folder's `README.md` explains how the technique works, the values that matter, and the production gotchas, for anyone who wants to build it by hand.+Here are 172 web animation techniques in one place, each shown working. Every page plays its animation live and gives you a ready-made prompt to paste into your AI assistant, so you can add the animation to your own site without writing the code yourself. Most pages also let you change the animation with a few plain settings, and the prompt you copy lists your choices. Each folder's `README.md` explains how the technique works, the values that matter, and the production gotchas, for anyone who wants to build it by hand.Everything is plain HTML, CSS, and JavaScript: no build step, no frameworks, no CDN. Open any page's `index.html` from a copy of this repository and its demo runs offline; [Run it locally](#run-it-locally) covers the parts that need a local server. Built to *inspire* and *teach*, not to sell a library.@@ -64,12 +64,12 @@ Then ask for an animation in plain words, like "make the cards fade in as they s| 03 | [Page Transitions](#03) | 17 || 04 | [Micro-Interactions](#04) | 44 || 05 | [Text & Typography](#05) | 19 |-| 06 | [3D & Advanced](#06) | 26 |+| 06 | [3D & Advanced](#06) | 27 || 07 | [Ambient & Background](#07) | 23 |## Full catalog-All 171 techniques, each linked to its live demo.+All 172 techniques, each linked to its live demo.Each technique's code and README are in its folder under [animations/](animations/).@@ -252,11 +252,11 @@ Each technique's code and README are in its folder under [animations/](animation<a id="06"></a>-### 06 · 3D & Advanced · 26 techniques+### 06 · 3D & Advanced · 27 techniques<sub>WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects.</sub>-<details><summary>Browse all 26 techniques in 3D & Advanced</summary>+<details><summary>Browse all 27 techniques in 3D & Advanced</summary>- **[3D Model Orbit](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/3d-model-orbit/)** — A lit 3D shape spins, or turns to face your pointer. Best for product views.- **[Scroll-Driven 3D Rotation](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/scroll-driven-3d-rotation/)** — Scrolling turns a 3D cube from pose to pose. Best for product tours.@@ -284,6 +284,7 @@ Each technique's code and README are in its folder under [animations/](animation- **[Liquid Glass](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/liquid-glass/)** — Drag a glass panel and the picture behind it bends at the edges. Best for cards.- **[Holographic Card](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/holographic-card/)** — A card tilts as you point, and its rainbow foil shimmers. Best for collectibles.- **[Infinite Zoom](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/infinite-zoom/)** — The view keeps zooming into pictures inside pictures. Best for page intros.+- **[Water Ripple](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/)** — Ripples spread from your finger and bend the picture below. Best for hero images.</details>diff --git a/animations/06-3d-advanced/README.md b/animations/06-3d-advanced/README.mdindex 191df6a0..e20ef26f 100644--- a/animations/06-3d-advanced/README.md+++ b/animations/06-3d-advanced/README.md@@ -32,6 +32,7 @@ WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects| [Liquid Glass](liquid-glass/) | Drag a glass panel and the picture behind it bends at the edges. Best for cards. || [Holographic Card](holographic-card/) | A card tilts as you point, and its rainbow foil shimmers. Best for collectibles. || [Infinite Zoom](infinite-zoom/) | The view keeps zooming into pictures inside pictures. Best for page intros. |+| [Water Ripple](water-ripple/) | Ripples spread from your finger and bend the picture below. Best for hero images. |## Key conceptsdiff --git a/animations/06-3d-advanced/infinite-zoom/index.html b/animations/06-3d-advanced/infinite-zoom/index.htmlindex 38e1ec10..1dc0d686 100644--- a/animations/06-3d-advanced/infinite-zoom/index.html+++ b/animations/06-3d-advanced/infinite-zoom/index.html@@ -32,7 +32,7 @@<body class="hb" data-hb-kind="loop"><nav class="hb-bar" aria-label="Animation Handbook"><a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>- <span class="hb-pager"><a href="../holographic-card/" rel="prev" aria-label="Previous: Holographic Card"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Holographic Card</span></a></span>+ <span class="hb-pager"><a href="../holographic-card/" rel="prev" aria-label="Previous: Holographic Card"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Holographic Card</span></a><a href="../water-ripple/" rel="next" aria-label="Next: Water Ripple"><span><span class="hb-dir">Next: </span>Water Ripple</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a></span><a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a></nav><main class="hb-page">diff --git a/animations/06-3d-advanced/water-ripple/README.md b/animations/06-3d-advanced/water-ripple/README.mdnew file mode 100644index 00000000..50b26cda--- /dev/null+++ b/animations/06-3d-advanced/water-ripple/README.md@@ -0,0 +1,52 @@+# Water Ripple++[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/)++## What it is+A water ripple effect makes a picture look as if it lies under clear water: a drag leaves a wake, a tap drops a pebble, and the ripples spread, cross, bounce off the edges and fade, bending the picture beneath them as they pass. It is a real little wave simulation, not rings drawn by formula, which is why two ripples cross and add up the way water does.++## When to use it+- Hero pictures on pool, spa, travel and seaside sites+- Playful backgrounds that invite people to touch them+- Landing pages for games or kids' products+- Photography sites, as a calm hover effect on one featured picture++## How it works+The water is two grids of heights, about one point per four pixels of the box (at most 200 across, 128 on phones): the heights now and one step earlier. At 60 fixed steps a second, every point becomes half the total of its four neighbors minus its own earlier height, then loses a little, so ripples spread outward, cross and fade; the edges stay flat, so waves bounce off them. The new heights are written over the earlier grid, and the two swap:++```js+for (let y = 1; y < gh - 1; y++) for (let x = 1, i = y * gw + 1; x < gw - 1; x++, i++)+ prev[i] = ((cur[i - 1] + cur[i + 1] + cur[i - gw] + cur[i + gw]) / 2 - prev[i]) * (1 - damp);+[cur, prev] = [prev, cur];+```++A touch pushes a small round dip into the grid (a tap drops a pebble, a wider and deeper dip). A drag's pushes are scaled by the time since the last pointer event, so a 120 Hz screen leaves the same wake as a 60 Hz one. To draw the water, each picture pixel shows the picture read from a spot shifted by the slope of the water there, so the picture bends under every wave; slopes that face the light get a lighter copy of the picture, which makes the glints:++```js+const dx = cur[i + 1] - cur[i - 1], dy = cur[i + gw] - cur[i - gw]; // i: the grid point under this pixel+const qx = clamp(X + Math.round(dx * b)), qy = clamp(Y + Math.round(dy * b)); // b: Bend, scaled to the grid+pixels[o] = lighter[glint(dx, dy)][qy * rw + qx]; // glint: 0 to 3, how much the slope faces the light+```++The pond is drawn once with canvas commands at twice the grid's size each way (two picture pixels for each grid point), so its pixels can be read, and three lighter copies of it are made for the glints. The result is written into that small canvas, which the browser stretches over the box. The steps come from an accumulator (at most three a frame, a third as many in slow motion), so the waves move at the same speed on every screen; once the water has stayed calm for a third of a second the loop stops and the plain picture is drawn, so the box is exactly at rest. Under reduced motion nothing moves: a tap or a drag shows still rings that fade within a second.++## Key parameters+| Parameter | Default | Effect |+|-----------|---------|--------|+| Ripple size | Medium | How wide each push is, in grid points of a full-size grid: small is 2, medium 3.5 and large 5.5 (a tap's pebble is half as wide again) |+| How long ripples last | Medium | How much height the water loses each step: short is 5%, which fades a pebble's rings within a second; medium 2.2%, about three seconds; long 0.9%, long enough for rings to bounce off the edges and cross |+| Bend | Medium | How far the picture under a slope is shifted: subtle is 5 grid points for a full slope, medium 12 and strong 22 |+| Light on the waves | on | Slopes that face the light show a lighter picture, in three steps of brightness; off, only the bending shows |++## Production notes+- **A coarse grid is enough.** The ripples are smooth, so a grid of one point per three to four pixels, drawn on a small canvas stretched over the box, looks as good as one point per pixel at a tenth of the cost. Use typed arrays and swap the two grids instead of copying them.+- **Fixed steps, then stop.** The wave rule needs equal steps: take them from an accumulator at a fixed rate, and stop the loop when the largest height is tiny, so a calm picture costs nothing.+- **Read the pixels once.** Draw the picture into the small canvas once and keep its pixels (`getImageData`); a picture from another site needs CORS headers, or the canvas cannot be read.+- **WebGL for full screen.** For a full-screen hero on a large display, the same two-grid rule runs in a fragment shader on ping-pong textures (as in the jQuery Ripples plugin or a Three.js render target), and the bending is a second shader that offsets the texture lookup.+- **Touch and keyboard.** Use Pointer Events with `touch-action: none` on the water only, so a finger that starts on the water draws a wake and the page still scrolls around it; scale each push by the time since the last pointer event, so a fast screen does not leave a stronger wake. Let the arrow keys move a ring that leaves a wake, and Enter or Space drop a pebble there.+- **Reduced motion.** Do not run the waves; a still ring that fades shows where the touch landed.++## See also+- [Cloth / Soft-Body Simulation](../cloth-simulation/) — fixed steps and a drag move a cloth+- [Image Distortion on Hover](../image-distortion-hover/) — rings worked out by formula warp a picture near the pointer+- [Ambient Ripple Effect](../../07-ambient-background/ambient-ripple/) — rings spread on their own, with no waterdiff --git a/animations/06-3d-advanced/water-ripple/index.html b/animations/06-3d-advanced/water-ripple/index.htmlnew file mode 100644index 00000000..c88d76dc--- /dev/null+++ b/animations/06-3d-advanced/water-ripple/index.html@@ -0,0 +1,410 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Water Ripple — Animation Handbook</title>+ <meta name="description" content="Ripples spread from your finger and bend the picture below. Best for hero images.">+ <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/">+ <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">+ <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">+ <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">+ <meta property="og:type" content="article">+ <meta property="og:site_name" content="Animation Handbook">+ <meta property="og:title" content="Water Ripple — Animation Handbook">+ <meta property="og:description" content="Ripples spread from your finger and bend the picture below. Best for hero images.">+ <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/">+ <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">+ <meta name="twitter:card" content="summary_large_image">+ <meta name="twitter:title" content="Water Ripple — Animation Handbook">+ <meta name="twitter:description" content="Ripples spread from your finger and bend the picture below. Best for hero images.">+ <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">+ <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Water Ripple", "name": "Water Ripple", "description": "Ripples spread from your finger and bend the picture below. Best for hero images.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/", "inLanguage": "en", "articleSection": "3D & Advanced", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, 3D & Advanced, Water Ripple"}</script>+ <style>+ :root{--ui-accent:#3fd6c4}+ *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}+ .stage{position:relative;overflow:hidden;background:#0b3b44}+ /* The water is drawn at the grid's size on small canvases that the browser stretches over the box (or a half of it) */+ .view{position:absolute;display:block;pointer-events:none}+ .view.half,.view.flat,#over,.wr-lbl,.divide{display:none}+ #cvs{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:crosshair;background:transparent}+ #cvs:focus-visible{outline:2px solid var(--ui-accent);outline-offset:-3px}+ /* The keyboard's spot: a small ring the arrow keys move, shown while the box has keyboard focus */+ .spot{position:absolute;left:0;top:0;width:26px;height:26px;margin:-13px 0 0 -13px;border:2px solid #fff;border-radius:50%;box-shadow:0 0 0 2px rgba(0,0,0,.45);opacity:0;pointer-events:none}+ #cvs:focus-visible~.spot{opacity:1}+ /* Under reduced motion a touch shows still rings that fade */+ .still-rings{position:absolute;width:120px;height:120px;margin:-60px 0 0 -60px;pointer-events:none;transition:opacity .9s linear}+ .stage[data-hb-mode="inside"] .view.whole,.stage[data-hb-mode="compare"] .view.whole{display:none}+ .stage[data-hb-mode="inside"] .view.flat,.stage[data-hb-mode="inside"] #over,.stage[data-hb-mode="compare"] .view.half,.stage[data-hb-mode="compare"] .divide{display:block}+ #over{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}+ .divide{position:absolute;left:calc(50% - 1px);top:0;width:2px;height:100%;background:#08262c}+ .wr-lbl{position:absolute;padding:3px 8px;border-radius:6px;background:rgba(6,20,24,.9);color:#f4f4f2;font:600 13px/1.25 var(--hb-font);pointer-events:none;max-width:46%}+ .stage[data-hb-mode="inside"] .in,.stage[data-hb-mode="compare"] .half-name{display:block}+ .in.crest{left:10px;top:10px}.in.patch{right:10px;bottom:104px;text-align:right}.in.read{left:10px;bottom:10px}+ .half-name{top:10px}.half-name.first{left:10px}.half-name.second{left:calc(50% + 10px)}+ </style>+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=10">+ <script src="../../../assets/js/demo-page.js?v=10" defer></script>+</head>+<body class="hb" data-hb-kind="do" data-hb-autoplay>+<nav class="hb-bar" aria-label="Animation Handbook">+ <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>+ <span class="hb-pager"><a href="../infinite-zoom/" rel="prev" aria-label="Previous: Infinite Zoom"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Infinite Zoom</span></a></span>+ <a class="hb-star" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener" aria-label="Star on GitHub"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg><span>Star on GitHub</span></a>+</nav>+<main class="hb-page">+ <header class="hb-head">+ <p class="hb-cat">06.27 · 3D & Advanced</p>+ <h1>Water Ripple</h1>+ <p class="hb-lede">Ripples spread from your finger and bend the picture below. Best for hero images.</p>+ </header>++ <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">+ <div class="hb-step-head">+ <span class="hb-num" aria-hidden="true">1</span>+ <div><h2 id="hb-watch-title">Drag it</h2><p>Drag across the pond (a finger will not scroll the page), tap for a pebble, use Tab and the arrow keys, or press Show me.</p></div>+ </div>+ <div class="seg hb-modes" role="group" aria-label="What the box shows" data-hb-modes>+ <button type="button" data-hb-mode="normal" class="on" aria-pressed="true">Normal</button>+ <button type="button" data-hb-mode="inside" aria-pressed="false">See inside</button>+ <button type="button" data-hb-mode="compare" aria-pressed="false">Compare</button>+ </div>+ <div class="stage">+ <canvas id="over" aria-hidden="true"></canvas><i class="divide" aria-hidden="true"></i>+ <canvas id="cvs" role="img" tabindex="0" aria-label="A pond with pebbles, a koi and lily pads under clear water. Drag or tap to make ripples; with the keyboard, the arrow keys move a ring and Enter drops a pebble."></canvas>+ <i class="spot" aria-hidden="true"></i>+ <p class="wr-lbl in crest" aria-hidden="true" data-hb-caption>Bright is a crest, dark a trough</p>+ <p class="wr-lbl in patch" aria-hidden="true" data-hb-caption>Each point: its neighbors, minus its last height</p>+ <p class="wr-lbl in read" aria-hidden="true" data-hb-caption>The picture is read from a shifted spot</p>+ <p class="wr-lbl half-name first" aria-hidden="true" data-hb-caption>Rings on top</p>+ <p class="wr-lbl half-name second" aria-hidden="true" data-hb-caption>Bends the picture</p>+ </div>+ <div class="hb-player">+ <button class="hb-play" type="button" id="btn-demo" data-hb-demo><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>Show me</button>+ <button class="hb-play" type="button" id="btn-reset" data-hb-reset><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>Reset</button>+ <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo autocomplete="off"><span>Slow motion</span></label>+ </div>+ <div class="hb-mode-notes" aria-live="polite">+ <p data-hb-for="inside" hidden>The gray map is the water's height; blue tints mark slopes facing the light. Each step, a point becomes half its neighbors' total minus its last height; the picture is read from a shifted spot.</p>+ <p data-hb-for="compare" hidden>Rings on top draws light rings over a picture that stays flat; Bends the picture shifts the picture itself under the waves, so it looks like water. Drag or tap either half.</p>+ </div>+ </section>++ <section class="hb-step hb-try" aria-labelledby="hb-try-title">+ <div class="hb-step-head">+ <span class="hb-num" aria-hidden="true">2</span>+ <div><h2 id="hb-try-title">Try it</h2><p>Change a setting, then drag the water or press Show me.</p></div>+ </div>+ <div class="hb-settings">+ <div class="hb-setting">+ <p class="hb-setting-name" id="size-lbl">Ripple size</p>+ <div class="seg" id="size-seg" role="group" aria-labelledby="size-lbl">+ <button type="button" data-r="2" aria-pressed="false">Small</button>+ <button type="button" data-r="3.5" class="on" aria-pressed="true">Medium</button>+ <button type="button" data-r="5.5" aria-pressed="false">Large</button>+ </div>+ <p class="hb-hint">How wide each push or drop is.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="last-lbl">How long ripples last</p>+ <div class="seg" id="last-seg" role="group" aria-labelledby="last-lbl">+ <button type="button" data-damp=".05" aria-pressed="false">Short</button>+ <button type="button" data-damp=".022" class="on" aria-pressed="true">Medium</button>+ <button type="button" data-damp=".009" aria-pressed="false">Long</button>+ </div>+ <p class="hb-hint">Long lets them bounce off the edges and cross.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="bend-lbl">Bend</p>+ <div class="seg" id="bend-seg" role="group" aria-labelledby="bend-lbl">+ <button type="button" data-bend="5" aria-pressed="false">Subtle</button>+ <button type="button" data-bend="12" class="on" aria-pressed="true">Medium</button>+ <button type="button" data-bend="22" aria-pressed="false">Strong</button>+ </div>+ <p class="hb-hint">How much the picture under the water bends.</p>+ </div>+ </div>+ <details class="hb-options">+ <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>+ <div class="hb-settings">+ <div class="hb-setting">+ <label class="hb-switch-row"><span>Light on the waves</span><input class="hb-switch" type="checkbox" role="switch" id="light-tog" checked autocomplete="off"></label>+ <p class="hb-hint">Bright glints on the slopes.</p>+ </div>+ </div>+ </details>+ </section>++ <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">+ <div class="hb-step-head">+ <span class="hb-num" aria-hidden="true">3</span>+ <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>+ </div>+ <div class="hb-card">+ <p class="hb-prompt">Add a water ripple effect to [the picture you want to look as if it lies under water]. Keep two grids of water heights, now and one step earlier. On each step, set every point to half the total of its four neighbors minus its earlier height, then damp it slightly, so ripples spread, cross, bounce off the edges and fade. A finger or mouse drag leaves a trail of small pushes without scrolling the page; a tap drops a pebble. Draw the picture shifted at each point by the slope of the water, so it bends under the waves. Use a coarse grid and fixed steps, and stop once the water is calm. Under reduced motion, show still rings that fade. Match the settings listed below.</p>+ <div class="hb-chips-box" hidden>+ <p class="hb-chips-title">Your settings</p>+ <ul class="hb-chips"></ul>+ </div>+ <div class="hb-copy-row">+ <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>+ <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>+ </div>+ </div>+ <div class="hb-star-row"><p>Free and open source. If this helped, a star on GitHub helps other people find it.</p><a class="hb-star-btn" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"/></svg>Star on GitHub</a></div>+ </section>++ <section class="hb-about" aria-labelledby="hb-what-title">+ <div class="hb-what">+ <h2 id="hb-what-title">What it is</h2>+ <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>+ </div>+ <div class="hb-fit">+ <h2>Good for</h2>+ <ul class="hb-tags hb-good"><li>Hero pictures</li><li>Pool, spa and travel sites</li><li>Playful backgrounds</li></ul>+ <h3>Avoid on</h3>+ <ul class="hb-tags hb-avoid"><li>Pictures with text</li><li>Busy pages</li></ul>+ </div>+ </section>++ <section class="hb-related" aria-labelledby="hb-related-title" hidden>+ <h2 id="hb-related-title">Similar animations</h2>+ <div class="hb-rel-list"></div>+ </section>+</main>+<footer class="hb-foot"><span>Animation Handbook</span><a href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">Source on GitHub</a><a href="#top">Back to top ↑</a></footer>+<script>+ const cvs=document.getElementById('cvs'),stage=cvs.parentElement,over=document.getElementById('over'),octx=over.getContext('2d');+ const spot=stage.querySelector('.spot'),slowTog=document.getElementById('slow-tog'),lightTog=document.getElementById('light-tog');+ const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),phone=matchMedia('(max-width:600px),(max-height:500px)');+ // CALM: below this height no point of the picture moves by a pixel or changes its light, so the water counts as calm; the two+ // views count it as calm at twice that, where their rings are too faint to see, so the still ripple stands in without a gap+ const FRAME=1000/60,CALM=.04,quiet=reduceMQ.matches,ASK=quiet?'see still rings':'make ripples';+ const LABELS={normal:'A pond with pebbles, a koi and lily pads under clear water. Drag or tap to '+ASK+'; with the keyboard, the arrow keys move a ring and Enter drops a pebble.',+ inside:'',+ compare:'The same ripples twice: light rings over a flat picture on the left, the picture bending under the water on the right. Drag or tap either half.'};+ let radius=3.5,damp=.022,bend=12,mode='normal',W=0,H=0,raf=0,lastT=null,behind=0,calmSteps=0,running=false;+ let main=null,pair=null,frozen=null,runTimers=[],path=null,down=null,key={x:.5,y:.5};+ // A water surface for a rectangle of the box (in shares of it): two grids of heights, now and one step earlier, about one point+ // per four pixels and at most 200 across (128 on phones, half that for Compare's water), and the views that draw it+ function Water(rect,cols){+ const gw=Math.max(24,cols),gh=Math.max(16,Math.round(gw*rect.h*H/(rect.w*W)));+ return{rect,gw,gh,cur:new Float32Array(gw*gh),prev:new Float32Array(gw*gh),sx:new Float32Array(gw*gh),sy:new Float32Array(gw*gh)};+ }+ // One step: every point becomes half the total of its four neighbors minus its own earlier height, then loses a little+ // (How long ripples last); the edges stay flat, so waves bounce off them. Returns the largest height left.+ function step(w){+ const {gw,gh,cur,prev}=w;let most=0;+ for(let y=1;y<gh-1;y++)for(let x=1,i=y*gw+1;x<gw-1;x++,i++){+ const v=((cur[i-1]+cur[i+1]+cur[i-gw]+cur[i+gw])/2-prev[i])*(1-damp);+ prev[i]=v;const a=v<0?-v:v;if(a>most)most=a;+ }+ w.cur=prev;w.prev=cur;return most;+ }+ // A push of the water at (x, y) in the box's pixels: a round dip, deeper in the middle; a pebble (big) is a wider, deeper one+ function push(w,x,y,k,big){+ const gx=(x/W-w.rect.x)/w.rect.w*w.gw,gy=(y/H-w.rect.y)/w.rect.h*w.gh,r=radius*(w.gw/(phone.matches?128:200))*(big?1.5:1);+ for(let j=Math.max(1,Math.floor(gy-r));j<=Math.min(w.gh-2,Math.ceil(gy+r));j++)for(let i=Math.max(1,Math.floor(gx-r));i<=Math.min(w.gw-2,Math.ceil(gx+r));i++){+ const d=Math.hypot(i-gx,j-gy)/r;if(d<1)w.cur[j*w.gw+i]-=k*.5*(1+Math.cos(d*Math.PI))}+ }+ // The pond, drawn with canvas commands at a view's size: deep water, a pebble floor, a koi and lily pads with a flower+ function pond(g,w,h){+ const s=Math.min(w/320,h/200),rnd=(n=>()=>{n=(n*16807)%2147483647;return n/2147483647})(42);+ const water=g.createLinearGradient(0,0,0,h);water.addColorStop(0,'#1d6f7a');water.addColorStop(1,'#0b3b44');g.fillStyle=water;g.fillRect(0,0,w,h);+ for(let i=0;i<140;i++){const x=rnd()*w,y=rnd()*h,r=(3+rnd()*8)*s,t=rnd();g.fillStyle=`rgb(${110+t*60|0},${118+t*44|0},${104+t*30|0})`;+ g.beginPath();g.ellipse(x,y,r,r*.7,rnd()*3,0,6.283);g.fill()}+ g.fillStyle='rgba(20,90,100,.35)';g.fillRect(0,0,w,h);+ const kx=w*.55,ky=h*.55;g.save();g.translate(kx,ky);g.rotate(-.35);g.scale(s,s);+ g.fillStyle='#f5f0e6';g.beginPath();g.ellipse(0,0,34,12,0,0,6.283);g.fill();+ g.fillStyle='#ff7a2f';g.beginPath();g.ellipse(-6,-2,16,9,0,0,6.283);g.fill();g.beginPath();g.ellipse(18,1,8,6,0,0,6.283);g.fill();+ g.fillStyle='#f5f0e6';g.beginPath();g.moveTo(-30,0);g.lineTo(-52,-12);g.lineTo(-48,0);g.lineTo(-52,12);g.closePath();g.fill();g.restore();+ for(const [px,py,pr] of [[.18,.3,22],[.8,.22,26],[.86,.72,18],[.28,.78,20]]){const x=px*w,y=py*h,r=pr*s;+ g.fillStyle='#3f8f3a';g.beginPath();g.moveTo(x,y);g.arc(x,y,r,.3,6.1);g.closePath();g.fill();g.strokeStyle='#2b6b2a';g.lineWidth=1.2*s;g.stroke()}+ g.fillStyle='#ff9ec0';for(let i=0;i<6;i++){g.beginPath();g.ellipse(w*.8+Math.cos(i)*5*s,h*.22+Math.sin(i)*5*s,6*s,3*s,i,0,6.283);g.fill()}+ g.fillStyle='#ffe38a';g.beginPath();g.arc(w*.8,h*.22,3*s,0,6.283);g.fill();+ }+ // A view: a small canvas for one water, twice the grid's size each way (R), stretched over its rectangle; it keeps the pond's+ // pixels and three lighter copies of them for the light on the waves+ const R=2;+ function View(w,cls){+ const c=document.createElement('canvas'),g=c.getContext('2d'),rw=w.gw*R,rh=w.gh*R;c.width=rw;c.height=rh;c.className='view '+cls;c.setAttribute('aria-hidden','true');+ Object.assign(c.style,{left:w.rect.x*100+'%',top:w.rect.y*100+'%',width:w.rect.w*100+'%',height:w.rect.h*100+'%'});+ stage.prepend(c);pond(g,rw,rh);+ const img=g.getImageData(0,0,rw,rh),base=new Uint32Array(img.data.buffer.slice(0)),lit=[base];+ for(const k of [.12,.24,.4]){const d=new Uint8ClampedArray(img.data),a=new Uint32Array(d.buffer);for(let i=0;i<d.length;i+=4){d[i]+=(255-d[i])*k;d[i+1]+=(255-d[i+1])*k;d[i+2]+=(255-d[i+2])*k}lit.push(a)}+ const dim=new Uint8ClampedArray(img.data.length);for(let i=0;i<dim.length;i++)dim[i]=img.data[i]*.3; // the pond at 30% strength, for See inside+ return{c,g,img,px:new Uint32Array(img.data.buffer),lit,dim};+ }+ // How much the height changes across each point, which the picture and See inside both read; a slope facing up and left (the+ // light's side) is lit from 1 to 3+ function slopes(w){+ const {gw,gh,cur,sx,sy}=w;+ for(let y=0,i=0;y<gh;y++)for(let x=0;x<gw;x++,i++){sx[i]=x>0&&x<gw-1?cur[i+1]-cur[i-1]:0;sy[i]=y>0&&y<gh-1?cur[i+gw]-cur[i-gw]:0}+ }+ const glint=(dx,dy)=>Math.min(3,Math.max(0,Math.round(-(dx+dy)*6)));+ // Draws a water in a view: each point shows the pond read from a spot shifted by the slope there (bend), lit where the slope+ // faces the light; rings: the pond stays where it is and only the light shows (Compare's first half)+ function paint(w,v,rings){+ const {gw,gh,sx,sy}=w,{px,lit}=v,rw=gw*R,rh=gh*R,b=bend*R*gw/(phone.matches?128:200),light=lightTog.checked||rings;+ for(let Y=0,o=0;Y<rh;Y++)for(let X=0;X<rw;X++,o++){+ const i=(Y/R|0)*gw+(X/R|0),dx=sx[i],dy=sy[i];+ let qx=X,qy=Y;if(!rings&&(dx||dy)){qx=Math.min(rw-1,Math.max(0,X+Math.round(dx*b)));qy=Math.min(rh-1,Math.max(0,Y+Math.round(dy*b)))}+ const l=light?rings?Math.min(3,Math.round((Math.abs(dx)+Math.abs(dy))*7)):glint(dx,dy):0;+ px[o]=lit[l][qy*rw+qx];+ }+ v.g.putImageData(v.img,0,0);+ }+ // See inside: the heights in grays over a faint pond (bright a crest, dark a trough), blue tints where a slope faces the light+ // (the Light switch), a magnified patch of nine points around the steepest spot, and on a coarse grid small arrows from each+ // point to the spot its picture is read from, as long as the picture's shift+ function paintInside(w,v){+ const {gw,gh,cur,sx,sy}=w,{dim}=v,u=v.img.data,rw=gw*R,tint=lightTog.checked;+ for(let y=0,i=0;y<gh;y++)for(let x=0;x<gw;x++,i++){ // each point's gray and tint, written to its R by R picture pixels+ const g=Math.max(0,Math.min(255,128+cur[i]*230))*.7,l=tint?glint(sx[i],sy[i]):0,r=g+l*4,gr=g+l*14,b=g+l*26;+ for(let j=0;j<R;j++)for(let k=0,q=((y*R+j)*rw+x*R)*4;k<R;k++,q+=4){u[q]=dim[q]+r;u[q+1]=dim[q+1]+gr;u[q+2]=dim[q+2]+b}}+ v.g.putImageData(v.img,0,0);+ octx.clearRect(0,0,W,H);+ const step=34,cx=W/gw,cy=H/gh,b=bend*gw/(phone.matches?128:200);+ octx.strokeStyle='#ffce5a';octx.lineWidth=1.8;octx.lineCap='round';octx.beginPath();+ for(let y=step/2;y<H-90;y+=step)for(let x=step/2;x<W;x+=step){+ const i=Math.min(gh-2,Math.max(1,y/cy|0))*gw+Math.min(gw-2,Math.max(1,x/cx|0)),dx=sx[i]*b*cx,dy=sy[i]*b*cy,len=Math.hypot(dx,dy);+ octx.moveTo(x,y);+ if(len<1.5){octx.lineTo(x,y);continue} // a dot: a point where the picture is not shifted+ const tx=x+dx,ty=y+dy;octx.lineTo(tx,ty);+ if(len>5){const a=Math.atan2(dy,dx),h=Math.min(4.5,len*.5);octx.lineTo(tx-h*Math.cos(a-.5),ty-h*Math.sin(a-.5));octx.moveTo(tx,ty);octx.lineTo(tx-h*Math.cos(a+.5),ty-h*Math.sin(a+.5))}}+ octx.stroke();octx.lineCap='butt';+ let best=gw+1,top=0;for(let i=gw+1;i<gw*(gh-1)-1;i++){const s=Math.abs(sx[i])+Math.abs(sy[i]);if(s>top){top=s;best=i}}+ const bx=best%gw,by=best/gw|0,size=phone.matches?18:22,ox=W-10-size*3,oy=H-10-size*3;+ for(let j=-1;j<=1;j++)for(let i=-1;i<=1;i++){const g=Math.max(0,Math.min(255,128+cur[best+j*gw+i]*230))|0;octx.fillStyle=`rgb(${g},${g},${g})`;octx.fillRect(ox+(i+1)*size+1,oy+(j+1)*size+1,size-2,size-2)}+ octx.strokeStyle='#ffce5a';octx.lineWidth=2;octx.strokeRect(ox+size+1,oy+size+1,size-2,size-2);+ octx.setLineDash([4,4]);octx.beginPath();octx.moveTo(ox,oy+size*1.5);octx.lineTo(bx*cx,by*cy);octx.stroke();octx.setLineDash([]);+ }+ function draw(){+ if(!main)return;+ const at=w=>calmNow(w)&&frozen?frozen[w===main?0:1]:w;+ if(mode==='inside'){const w=at(main);slopes(w);paintInside(w,main.views[1])}+ else if(mode==='compare'){const w=at(pair);slopes(w);paint(w,pair.views[0],true);paint(w,pair.views[1],false)}+ else{slopes(main);paint(main,main.views[0],false)}+ }+ const calmNow=w=>!running&&w.still;+ // The loop takes fixed steps of a 60th of a second (a third as many in slow motion, at most three a frame) and stops once the+ // water is calm for a third of a second: then the plain picture (or See inside's and Compare's frozen ripple) is drawn+ function loop(ts){+ if(reduceMQ.matches){calm();return} // reduced motion turned on while the water moves: it goes flat at once+ raf=requestAnimationFrame(loop);+ if(lastT===null){lastT=ts;return}+ const dt=Math.min(ts-lastT,50)*(slowTog.checked?1/3:1);lastT=ts;behind+=dt;+ const w=mode==='compare'?pair:main;+ if(path)trace(dt);+ let n=0,most=1;while(behind>=FRAME-1&&n<3){most=step(w);behind-=FRAME;n++}+ if(n){calmSteps=most<(mode==='normal'?CALM:CALM*2)?calmSteps+n:0;w.still=false}+ if(calmSteps>20&&!path){w.cur.fill(0);w.prev.fill(0);w.still=true;running=false;cancelAnimationFrame(raf);raf=0}+ if(n||path)draw();+ }+ function wake(){if(reduceMQ.matches)return;running=true;calmSteps=0;(mode==='compare'?pair:main).still=false;if(!raf){lastT=null;behind=0;raf=requestAnimationFrame(loop)}}+ function calm(){for(const w of [main,pair]){w.cur.fill(0);w.prev.fill(0);w.still=true}running=false;cancelAnimationFrame(raf);raf=0;draw()}+ // A touch on the water, k strong (a pebble is a tap): in Compare a touch on either half reaches the one water both halves draw+ let ringAt=-1e9;+ function touchAt(x,y,k,pebble){+ if(reduceMQ.matches){const now=performance.now();if(pebble||now-ringAt>300){ringAt=now;stillRings(x,y)}return}+ const w=mode==='compare'?pair:main;if(mode==='compare'&&x>W/2)x-=W/2;+ push(w,x,y,k,pebble);wake();+ }+ // Under reduced motion: still rings at the spot, which fade within a second (a few per touch at most)+ function stillRings(x,y){+ const r=document.createElementNS('http://www.w3.org/2000/svg','svg');r.setAttribute('viewBox','-60 -60 120 120');r.setAttribute('class','still-rings');r.setAttribute('aria-hidden','true');+ r.innerHTML=[18,34,50].map((c,i)=>`<circle r="${c}" fill="none" stroke="rgba(255,255,255,${.8-i*.2})" stroke-width="2"/>`).join('');+ r.style.left=x+'px';r.style.top=y+'px';stage.insertBefore(r,spot);+ setTimeout(()=>{r.style.opacity='0';setTimeout(()=>r.remove(),950)},60);+ }+ // Pointer Events for mouse, pen and touch: a drag leaves a trail of small pushes, a short tap drops a pebble; a mouse that only+ // points leaves a faint wake. A push is as strong per second on a 120 Hz screen as on a 60 Hz one: it follows the time since+ // the last event.+ const local=e=>{const r=cvs.getBoundingClientRect();return{x:e.clientX-r.left,y:e.clientY-r.top}};+ let moveT=0;+ const pace=t=>{const gap=t-moveT,q=gap>100?1:Math.min(3,Math.max(.25,gap/FRAME));moveT=t;return q};+ cvs.addEventListener('pointerdown',e=>{if(e.button)return;const p=local(e);down={...p,t:e.timeStamp,moved:0};moveT=e.timeStamp;cvs.setPointerCapture(e.pointerId)});+ cvs.addEventListener('pointermove',e=>{const p=local(e),q=pace(e.timeStamp);+ if(down){down.moved+=Math.hypot(p.x-down.x,p.y-down.y);down.x=p.x;down.y=p.y;touchAt(p.x,p.y,.35*q)}+ else if(e.pointerType==='mouse'&&!reduceMQ.matches)touchAt(p.x,p.y,.12*q)});+ cvs.addEventListener('pointerup',e=>{if(down&&down.moved<8&&e.timeStamp-down.t<400)touchAt(down.x,down.y,1,true);down=null});+ cvs.addEventListener('pointercancel',()=>{down=null});+ // The keyboard: the arrow keys move the ring, leaving a wake (Shift for bigger moves); Enter or Space drops a pebble there+ cvs.addEventListener('keydown',e=>{+ const d={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];+ if(d){e.preventDefault();const k=e.shiftKey?.12:.04;key.x=Math.min(.97,Math.max(.03,key.x+d[0]*k));key.y=Math.min(.95,Math.max(.05,key.y+d[1]*k));placeSpot();touchAt(key.x*W,key.y*H,.35)}+ else if(e.key==='Enter'||e.key===' '){e.preventDefault();touchAt(key.x*W,key.y*H,1,true)}+ });+ const placeSpot=()=>{spot.style.transform=`translate(${key.x*W}px,${key.y*H}px)`};+ // Show me: a finger draws an S across the pond (across one half in Compare, so the S is whole in both), then two taps (3 s in+ // all); the water then calms by itself. The S moves by the time that passed; the taps wait with timers, as every pause of a run does.+ const span=()=>mode==='compare'?W/2:W;+ function later(fn,ms){const id=setTimeout(()=>{runTimers=runTimers.filter(t=>t!==id);fn()},ms*(slowTog.checked?3:1));runTimers.push(id)}+ function stopRun(){runTimers.forEach(clearTimeout);runTimers=[];path=null}+ function trace(dt){+ path.t+=dt/1800;const t=Math.min(1,path.t),x=span()*(.2+.6*t),y=H*(.5+.28*Math.sin(t*Math.PI*2));+ touchAt(x,y,.35*dt/FRAME);if(t>=1)path=null;+ }+ document.getElementById('btn-demo').addEventListener('click',()=>{+ stopRun();+ if(reduceMQ.matches){touchAt(W*.32,H*.45,1,true);later(()=>touchAt(W*.68,H*.58,1,true),800);return}+ path={t:0};wake();+ later(()=>touchAt(span()*.3,H*.32,1,true),2000);later(()=>touchAt(span()*.72,H*.68,1,true),2500);+ });+ document.getElementById('btn-reset').addEventListener('click',()=>{stopRun();calm()});+ document.addEventListener('hb:input',()=>{if(runTimers.length||path)stopRun()});+ stage.addEventListener('focusin',e=>{if(e.isTrusted&&(runTimers.length||path))stopRun()});+ // The mode switch draws the mode at once; See inside and Compare show a frozen ripple while the water is calm+ // Normal and See inside show one water, Compare another: each keeps moving where it was left, so the water a mode shows wakes+ // if it was still moving when the loop stopped for the other+ document.addEventListener('hb:mode',e=>{+ mode=e.detail.mode;cvs.setAttribute('aria-label',LABELS[mode]);if(mode!=='inside')octx.clearRect(0,0,W,H);draw();+ const w=mode==='compare'?pair:main;if(!w.still&&!reduceMQ.matches)wake();+ });+ // A frozen ripple for See inside and Compare at rest: two pebbles from a fixed start, a fixed number of steps on+ function freeze(){+ frozen=[main,pair].map(w=>{const f={...w,cur:new Float32Array(w.cur.length),prev:new Float32Array(w.cur.length)};+ push(f,W*(w===main?.36:.18),H*.45,1.4,true);push(f,W*(w===main?.66:.34),H*.6,1.1,true);for(let i=0;i<26;i++)step(f);return f});+ }+ function build(){+ stage.querySelectorAll('.view').forEach(c=>c.remove());+ const cols=Math.min(phone.matches?128:200,Math.round(W/4)),half=Math.round(cols/2);+ main=Water({x:0,y:0,w:1,h:1},cols);main.views=[View(main,'whole'),View(main,'flat')];main.still=true;+ pair=Water({x:0,y:0,w:.5,h:1},half);pair.views=[View(pair,'half'),View({...pair,rect:{x:.5,y:0,w:.5,h:1}},'half')];pair.still=true;+ freeze();+ }+ function resize(){+ const w=stage.clientWidth,h=stage.clientHeight;if(!w||!h||(w===W&&h===H))return;W=w;H=h;+ const dpr=Math.min(devicePixelRatio||1,1.5);over.width=W*dpr;over.height=H*dpr;octx.setTransform(dpr,0,0,dpr,0,0);+ stopRun();running=false;cancelAnimationFrame(raf);raf=0;build();placeSpot();draw();+ }+ function choices(id,pick){+ const buttons=document.querySelectorAll('#'+id+' button');+ buttons.forEach(b=>b.addEventListener('click',()=>{+ buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});+ pick(b.dataset);if(main){freeze();draw()}+ }));+ }+ choices('size-seg',d=>{radius=+d.r});+ choices('last-seg',d=>{damp=+d.damp});+ choices('bend-seg',d=>{bend=+d.bend});+ // The notes and See inside's name follow the Light switch and reduced motion (the markup holds the words for light on, with+ // motion): under reduced motion the water never moves, so they say what the still views show+ const noteIn=document.querySelector('[data-hb-for="inside"]'),noteCmp=document.querySelector('[data-hb-for="compare"]');+ const NOTE_IN=quiet?["Shown still: the gray map is the water's height. Each point is half its neighbors' total minus its last height; arrows show where the picture is read from.",+ "Shown still: the gray map is the water's height; blue tints mark slopes facing the light. Each point is half its neighbors' total minus its last height; arrows show where the picture is read from."]+ :["The gray map is the water's height. Each step, a point becomes half its neighbors' total minus its last height, and the picture is read from a spot shifted by the slope.",noteIn.textContent];+ function notes(){+ const lit=lightTog.checked;+ noteIn.textContent=NOTE_IN[+lit];+ LABELS.inside="The water's height as a gray map over a faint pond,"+(lit?' blue tints on slopes that face the light,':'')+' a magnified patch of nine points and arrows to the spots the picture is read from. Drag or tap to '+ASK+'.';+ cvs.setAttribute('aria-label',LABELS[mode]);+ }+ lightTog.addEventListener('change',()=>{notes();draw()});+ if(quiet)noteCmp.textContent='Shown still: Rings on top draws light rings over a flat picture, while Bends the picture shifts the picture itself under the waves, so it looks like water.';+ notes();+ new ResizeObserver(resize).observe(stage);+ resize();+</script>+</body>+</html>diff --git a/animations/07-ambient-background/ambient-ripple/README.md b/animations/07-ambient-background/ambient-ripple/README.mdindex 1d84ce31..95e49e4d 100644--- a/animations/07-ambient-background/ambient-ripple/README.md+++ b/animations/07-ambient-background/ambient-ripple/README.md@@ -90,3 +90,4 @@ function updateSource(source) {- [Click / Tap Ripple](../../04-micro-interactions/click-ripple/) — a ripple that answers a click instead- [Breathing / Pulsing Glow](../breathing-glow/) — one glow that grows and shrinks instead of rings- [Abstract Geometric Motion](../abstract-geometric-motion/) — its Rings pattern spreads rings from the center+- [Water Ripple](../../06-3d-advanced/water-ripple/) — ripples from a finger spread and bend the picture belowdiff --git a/index.html b/index.htmlindex 5b607c73..939dbdff 100644--- a/index.html+++ b/index.html@@ -4,8 +4,8 @@<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="google-site-verification" content="2PnJemecfPix7j08I3cojuzPTfwKpwxxFMADFxv4wk8">-<title>Animation Handbook — 171 Web Animation Techniques with Live Demos</title>-<meta name="description" content="A free visual reference of 171 web animation techniques, from scroll effects to 3D: each plays live and comes with a ready-made prompt for your AI assistant.">+<title>Animation Handbook — 172 Web Animation Techniques with Live Demos</title>+<meta name="description" content="A free visual reference of 172 web animation techniques, from scroll effects to 3D: each plays live and comes with a ready-made prompt for your AI assistant."><meta name="keywords" content="web animation, CSS animation, animation examples, scroll animation, page transitions, micro-interactions, kinetic typography, WebGL, frontend animation reference, motion design, animation handbook"><meta name="author" content="Matin Monshizadeh"><meta name="robots" content="index, follow, max-image-preview:large">@@ -19,8 +19,8 @@<!-- Open Graph --><meta property="og:type" content="website"><meta property="og:site_name" content="Animation Handbook">-<meta property="og:title" content="Animation Handbook — 171 Web Animation Techniques with Live Demos">-<meta property="og:description" content="A free visual reference of 171 web animation techniques, from scroll effects to 3D: each plays live and comes with a ready-made prompt for your AI assistant.">+<meta property="og:title" content="Animation Handbook — 172 Web Animation Techniques with Live Demos">+<meta property="og:description" content="A free visual reference of 172 web animation techniques, from scroll effects to 3D: each plays live and comes with a ready-made prompt for your AI assistant."><meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/"><meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png"><meta property="og:image:width" content="1200">@@ -28,8 +28,8 @@<!-- Twitter --><meta name="twitter:card" content="summary_large_image">-<meta name="twitter:title" content="Animation Handbook — 171 Web Animation Techniques with Live Demos">-<meta name="twitter:description" content="A free visual reference of 171 web animation techniques, from scroll effects to 3D: each plays live and comes with a ready-made prompt for your AI assistant.">+<meta name="twitter:title" content="Animation Handbook — 172 Web Animation Techniques with Live Demos">+<meta name="twitter:description" content="A free visual reference of 172 web animation techniques, from scroll effects to 3D: each plays live and comes with a ready-made prompt for your AI assistant."><meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png"><!-- Structured data: parsed by search + AI answer engines -->@@ -39,7 +39,7 @@"@type": "WebSite","name": "Animation Handbook","url": "https://matinmonshizadeh.github.io/animation-handbook/",- "description": "A free visual reference of 171 web animation techniques, from scroll effects to 3D: each plays live and comes with a ready-made prompt for your AI assistant.",+ "description": "A free visual reference of 172 web animation techniques, from scroll effects to 3D: each plays live and comes with a ready-made prompt for your AI assistant.","inLanguage": "en","author": { "@type": "Person", "name": "Matin Monshizadeh" },"about": ["web animation", "CSS animation", "motion design", "frontend development"],@@ -1280,6 +1280,12 @@ button,input{font:inherit;color:inherit}.pv-izoom .p{--k:0;--b:linear-gradient(135deg,#7a4d2c,#4b2c17);--f:#f5f1e8}@keyframes d-izoom{0%{transform:scale(.0256)}20%{transform:scale(.064)}40%{transform:scale(.16)}60%{transform:scale(.4)}80%{transform:scale(1)}100%{transform:scale(2.5)}}+.pv-waterripple{background:radial-gradient(4% 6% at 14% 22%,#9a9585 60%,#0000 64%),radial-gradient(5% 7.5% at 30% 70%,#9a9585 60%,#0000 64%),radial-gradient(3.5% 5.25% at 52% 30%,#9a9585 60%,#0000 64%),radial-gradient(5% 7.5% at 70% 64%,#9a9585 60%,#0000 64%),radial-gradient(4% 6% at 86% 26%,#9a9585 60%,#0000 64%),radial-gradient(3.5% 5.25% at 62% 86%,#9a9585 60%,#0000 64%),radial-gradient(4.5% 6.75% at 20% 88%,#9a9585 60%,#0000 64%),radial-gradient(3% 4.5% at 44% 56%,#9a9585 60%,#0000 64%),radial-gradient(4% 6% at 92% 80%,#9a9585 60%,#0000 64%),linear-gradient(#1d6f7a,#0b3b44);overflow:hidden}+.pv-waterripple i{position:absolute;width:60%;aspect-ratio:1;border-radius:50%;border:1.5px solid rgba(240,255,255,.8);opacity:0;transform:translate(-50%,-50%) scale(.05);+ animation:waterripple-ring 3s ease-out infinite}+.pv-waterripple .a{left:36%;top:46%}.pv-waterripple .b{left:64%;top:58%;animation-delay:-1.5s}.pv-waterripple .r2{animation-delay:-.6s}.pv-waterripple .b.r2{animation-delay:-2.1s}+@keyframes waterripple-ring{0%{opacity:.9;transform:translate(-50%,-50%) scale(.05)}100%{opacity:0;transform:translate(-50%,-50%) scale(1)}}+/* ── bespoke: 07 Ambient & Background ── */.pv-grain2{background:radial-gradient(circle at 50% 40%,#1a1710,#08080a);overflow:hidden}.pv-grain2 .g{position:absolute;inset:-50%;opacity:.5;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");animation:d-grain .5s steps(4) infinite}@@ -1697,7 +1703,7 @@ button,input{font:inherit;color:inherit}<section class="wrap home-hero" aria-labelledby="hero-title"><span class="float fl1" aria-hidden="true"></span><span class="float fl2" aria-hidden="true"></span><span class="float fl3" aria-hidden="true"></span><span class="float fl4" aria-hidden="true"></span><span class="float fl5" aria-hidden="true"></span><span class="float fl6" aria-hidden="true"></span>- <p class="pill"><span class="pill-dot" aria-hidden="true"></span>171 free animations · no coding needed</p>+ <p class="pill"><span class="pill-dot" aria-hidden="true"></span>172 free animations · no coding needed</p><h1 class="h1" id="hero-title">What do you want to animate?</h1><p class="sub">Pick a place, or describe it in your own words. Every animation plays live, and each one comes with a ready-made prompt for your AI assistant.</p><form class="search" id="search-form" role="search" action="./" method="get">@@ -1762,14 +1768,14 @@ button,input{font:inherit;color:inherit}<p class="empty-s">Try a simpler word, or pick one of these:</p><p class="pop"><button type="button" data-q="fade in">fade in</button><button type="button" data-q="typing text">typing text</button><button type="button" data-q="loading spinner">loading spinner</button><button type="button" data-q="parallax">parallax</button><button type="button" data-q="confetti">confetti</button></p></div>- <div class="more" id="more"><button type="button" class="bigbtn" id="more-btn"><span id="more-label">Browse all 171 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div>+ <div class="more" id="more"><button type="button" class="bigbtn" id="more-btn"><span id="more-label">Browse all 172 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div><div class="fd-not" id="find-not" hidden><h3 class="fd-not-t">Not here?</h3><p class="fd-not-s" id="find-not-s">Tell us what you saw. We use it to add the animation or to fix the finder.</p><p class="fd-not-acts"><a class="fd-btn" id="find-gh" href="https://github.com/matinmonshizadeh/animation-handbook/issues/new?template=animation_not_here.yml" target="_blank" rel="noopener">Tell us on GitHub</a><button type="button" class="pillbtn" id="find-words">Describe it in words</button></p><p class="fd-fine">The form is on GitHub and needs a free account.</p></div>- <noscript><p class="noscript">This page shows its animations with JavaScript. All 171 are still easy to reach: see the <a href="https://github.com/matinmonshizadeh/animation-handbook#categories">category list on GitHub</a> or the <a href="sitemap.xml">full sitemap</a>. Each demo is a page of its own under <code>/animations/<category>/<name>/</code>.</p></noscript>+ <noscript><p class="noscript">This page shows its animations with JavaScript. All 172 are still easy to reach: see the <a href="https://github.com/matinmonshizadeh/animation-handbook#categories">category list on GitHub</a> or the <a href="sitemap.xml">full sitemap</a>. Each demo is a page of its own under <code>/animations/<category>/<name>/</code>.</p></noscript></section><section class="how" id="how" aria-labelledby="how-title">@@ -1787,7 +1793,7 @@ button,input{font:inherit;color:inherit}<footer class="wrap foot"><a class="brand" href="./"><svg class="mark" viewBox="0 0 32 32" aria-hidden="true"><circle class="ring" cx="11.16" cy="20.84" r="6.1"/><circle class="ring" cx="15.12" cy="16.88" r="6.1"/><circle class="ring" cx="18.51" cy="13.49" r="6.1"/><circle class="ball" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>- <p class="foot-t">171 web animations with live demos and copyable prompts.</p>+ <p class="foot-t">172 web animations with live demos and copyable prompts.</p><nav class="nav" aria-label="Footer"><a class="lnk" href="famous/">Famous effects</a><a class="lnk" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener">GitHub</a><a class="lnk" href="#top">Back to top</a></nav></footer><div class="toast" id="toast" role="status" aria-live="polite"><span class="ok" aria-hidden="true"><svg class="i" viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="toast-t"></span></div>@@ -1991,6 +1997,7 @@ const CATS=[['liquid-glass','Liquid Glass','Drag a glass panel and the picture behind it bends at the edges. Best for cards.'],['holographic-card','Holographic Card','A card tilts as you point, and its rainbow foil shimmers. Best for collectibles.'],['infinite-zoom','Infinite Zoom','The view keeps zooming into pictures inside pictures. Best for page intros.'],+ ['water-ripple','Water Ripple','Ripples spread from your finger and bend the picture below. Best for hero images.'],]},{@@ -2036,7 +2043,7 @@ const PV={'typing-indicator':'typing','hold-to-confirm':'holdconf','expanding-search':'xsearch','button-loading-states':'btnload','image-trail':'imgtrail','gooey-menu':'gooey','dynamic-island':'dynisland','before-after-slider':'beforeafter','magnifier-lens':'magnifier','card-deck-swipe':'deckswipe',- 'flip-card-3d':'flip3d','carousel-3d':'carousel3d','depth-map-photo':'depthmap','flocking':'flock','ascii-halftone':'ascii','physics-2d':'phys2d','liquid-glass':'liquidglass','holographic-card':'holo','infinite-zoom':'izoom','matrix-rain':'matrix','plasma':'plasmapv',+ 'flip-card-3d':'flip3d','carousel-3d':'carousel3d','depth-map-photo':'depthmap','flocking':'flock','ascii-halftone':'ascii','physics-2d':'phys2d','liquid-glass':'liquidglass','holographic-card':'holo','infinite-zoom':'izoom','water-ripple':'waterripple','matrix-rain':'matrix','plasma':'plasmapv','wave-layers':'wavelayers','snow-rain':'snowrain','fireworks':'fireworks','topographic-lines':'topo','light-rays':'rays','game-of-life':'life','parallax-depth-of-field':'dof','parallax-scrolling':'plx','reverse-scrolling-columns':'revcol',@@ -2231,6 +2238,7 @@ const PLACES={'liquid-glass':['imgcard','menu'],'holographic-card':['imgcard'],'infinite-zoom':['intro','bg'],+ 'water-ripple':['bg','imgcard'],// 07'animated-gradient-background':['bg'],'mesh-gradient':['bg'],@@ -2412,6 +2420,7 @@ const FIND={'liquid-glass':['card menu button','drag click scroll','wave follow bounce slide'],'holographic-card':['card','hover drag','color turn follow'],'infinite-zoom':['card background page','loop scroll load','grow'],+ 'water-ripple':['background card','drag click hover','wave'],// 07'animated-gradient-background':['background','loop','color drift'],'mesh-gradient':['background','loop','color drift morph'],@@ -2535,6 +2544,7 @@ function pvMarkup(k){case 'liquidglass': {const sc=k=>'<span class="sc'+k+'"><b class="sun"></b><b class="city"></b><b class="sea"></b></span>';return sc('')+'<span class="gl anim">'+sc(' anim')+'</span>';}case 'holo': return '<span class="hc anim"><i class="cr"></i><i class="fo anim"></i><i class="gl anim"></i><i class="np"></i><i class="ip"></i></span>';case 'izoom': return '<i class="g anim"></i><i class="d anim"></i><i class="t anim"></i><i class="l anim"></i><i class="p anim"></i>';+ case 'waterripple': return '<i class="a anim"></i><i class="a r2 anim"></i><i class="b anim"></i><i class="b r2 anim"></i>';case 'carousel3d': return '<div class="sc"><div class="tl"><div class="rg anim">'+[0,1,2,3,4,5].map(k=>'<i style="--k:'+k+'"></i>').join('')+'</div></div></div>';case 'depthmap': return [['sun',-.4],['mt',-.2],['hl',.05],['md',.25],['tr',.45],['gd',.55]].map(([c,k])=>'<i class="'+c+' anim" style="--k:'+k+'"></i>').join('');case 'flock': return '<span class="fk anim">'+[[0,18,0],[-10,6,-.3],[9,5,-.7],[-20,-5,-1.1],[1,-4,-.5],[17,-8,-.9],[-8,-17,-.2],[10,-20,-1.2],[-1,-29,-.6]].map(function(b){return '<i class="anim" style="--x:'+b[0]+'%;--y:'+b[1]+'%;--d:'+b[2]+'s"></i>';}).join('')+'</span>';diff --git a/llms.txt b/llms.txtindex f3805f2b..8b2647e3 100644--- a/llms.txt+++ b/llms.txt@@ -1,8 +1,8 @@# Animation Handbook-> A visual reference of 171 web animation techniques, each with a live demo and a plain-words prompt for building it with an AI assistant.+> A visual reference of 172 web animation techniques, each with a live demo and a plain-words prompt for building it with an AI assistant.-Each page plays one technique live and gives a ready-made prompt that describes it in plain words, with no code. Most pages also have a few plain settings, such as speed or direction, and the prompt you copy lists your choices. Each technique's folder on GitHub has a README on how it works, the values that matter and production notes. To give an AI coding assistant all 171 prompts and settings at once, install the Agent Skill: `npx skills add matinmonshizadeh/animation-handbook`.+Each page plays one technique live and gives a ready-made prompt that describes it in plain words, with no code. Most pages also have a few plain settings, such as speed or direction, and the prompt you copy lists your choices. Each technique's folder on GitHub has a README on how it works, the values that matter and production notes. To give an AI coding assistant all 172 prompts and settings at once, install the Agent Skill: `npx skills add matinmonshizadeh/animation-handbook`.## Scroll-Based@@ -169,6 +169,7 @@ Each page plays one technique live and gives a ready-made prompt that describes- [Liquid Glass](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/liquid-glass/): Drag a glass panel and the picture behind it bends at the edges. Best for cards.- [Holographic Card](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/holographic-card/): A card tilts as you point, and its rainbow foil shimmers. Best for collectibles.- [Infinite Zoom](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/infinite-zoom/): The view keeps zooming into pictures inside pictures. Best for page intros.+- [Water Ripple](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/): Ripples spread from your finger and bend the picture below. Best for hero images.## Ambient & Background@@ -203,13 +204,13 @@ Each page plays one technique live and gives a ready-made prompt that describes## Skill files- [SKILL.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/SKILL.md): how to find a technique, choose its settings for the user's page and build it, with the rules for real pages-- [references/catalog.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/catalog.md): all 171 in one list, with what each does and where it goes, and an index by place+- [references/catalog.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/catalog.md): all 172 in one list, with what each does and where it goes, and an index by place- [references/01-scroll-based.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/01-scroll-based.md): the 27 Scroll-Based entries, each with its prompt and its settings, with the demo's values- [references/02-entrance-and-exit.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/02-entrance-and-exit.md): the 15 Entrance & Exit entries, each with its prompt and its settings, with the demo's values- [references/03-page-transitions.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/03-page-transitions.md): the 17 Page Transitions entries, each with its prompt and its settings, with the demo's values- [references/04-micro-interactions.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/04-micro-interactions.md): the 44 Micro-Interactions entries, each with its prompt and its settings, with the demo's values- [references/05-text-typography.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/05-text-typography.md): the 19 Text & Typography entries, each with its prompt and its settings, with the demo's values-- [references/06-3d-advanced.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/06-3d-advanced.md): the 26 3D & Advanced entries, each with its prompt and its settings, with the demo's values+- [references/06-3d-advanced.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/06-3d-advanced.md): the 27 3D & Advanced entries, each with its prompt and its settings, with the demo's values- [references/07-ambient-background.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/07-ambient-background.md): the 23 Ambient & Background entries, each with its prompt and its settings, with the demo's values## Optionaldiff --git a/og-image.png b/og-image.pngindex ef7ad282..7d983467 100644Binary files a/og-image.png and b/og-image.png differdiff --git a/sitemap.xml b/sitemap.xmlindex e968ca97..c3c7af7b 100644--- a/sitemap.xml+++ b/sitemap.xml@@ -1,6 +1,6 @@<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">- <url><loc>https://matinmonshizadeh.github.io/animation-handbook/</loc><lastmod>2026-10-16</lastmod><changefreq>weekly</changefreq><priority>1.0</priority></url>+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/</loc><lastmod>2026-10-17</lastmod><changefreq>weekly</changefreq><priority>1.0</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/famous/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/01-scroll-based/parallax-depth-of-field/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/01-scroll-based/parallax-scrolling/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>@@ -149,7 +149,8 @@<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/physics-2d/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/liquid-glass/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/holographic-card/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>- <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/infinite-zoom/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/infinite-zoom/</loc><lastmod>2026-10-17</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/</loc><lastmod>2026-10-17</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/animated-gradient-background/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/mesh-gradient/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/aurora/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>@@ -158,7 +159,7 @@<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/light-leak/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/starfield/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/breathing-glow/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>- <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/ambient-ripple/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/ambient-ripple/</loc><lastmod>2026-10-17</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/floating-elements/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/grid-dot-pattern-parallax/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/abstract-geometric-motion/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>diff --git a/skills/animation-handbook/SKILL.md b/skills/animation-handbook/SKILL.mdindex d3162149..c719f5e0 100644--- a/skills/animation-handbook/SKILL.md+++ b/skills/animation-handbook/SKILL.md@@ -1,12 +1,12 @@---name: animation-handbook-description: Builds web animations from Animation Handbook, a set of 171 tested techniques with plain-words build prompts and settings (scroll effects, entrances and exits, page transitions, micro-interactions for buttons and forms, text effects, 3D and WebGL, ambient backgrounds). Use when the user asks to add, pick or improve an animation, transition, hover or click effect, loading state, scroll effect or background motion in a web page or web app, in any framework or plain HTML, CSS and JavaScript.+description: Builds web animations from Animation Handbook, a set of 172 tested techniques with plain-words build prompts and settings (scroll effects, entrances and exits, page transitions, micro-interactions for buttons and forms, text effects, 3D and WebGL, ambient backgrounds). Use when the user asks to add, pick or improve an animation, transition, hover or click effect, loading state, scroll effect or background motion in a web page or web app, in any framework or plain HTML, CSS and JavaScript.license: MIT---# Animation Handbook-[Animation Handbook](https://matinmonshizadeh.github.io/animation-handbook/) is a free reference of 171 web animation techniques. Each has a live demo, a few plain settings for most (speed, direction, color and the like) and a prompt that says in plain words how to build it. This skill holds every prompt and every setting with the demo's values.+[Animation Handbook](https://matinmonshizadeh.github.io/animation-handbook/) is a free reference of 172 web animation techniques. Each has a live demo, a few plain settings for most (speed, direction, color and the like) and a prompt that says in plain words how to build it. This skill holds every prompt and every setting with the demo's values.## How to use it@@ -36,13 +36,13 @@ Keep these even where a prompt does not say them, and follow them where a prompt## Where to look-- [references/catalog.md](references/catalog.md): all 171 in one list, grouped by category, with an index by place.+- [references/catalog.md](references/catalog.md): all 172 in one list, grouped by category, with an index by place.- [references/01-scroll-based.md](references/01-scroll-based.md): Scroll-Based, 27 animations. Animations driven by scroll position — parallax, sticky, scrub, snap, and storytelling.- [references/02-entrance-and-exit.md](references/02-entrance-and-exit.md): Entrance & Exit, 15 animations. Element-level animations for arriving and departing — fades, slides, reveals, flips, and text staggers.- [references/03-page-transitions.md](references/03-page-transitions.md): Page Transitions, 17 animations. Full-page transitions between routes or views — crossfades, slides, portals, morphs, and the View Transitions API.- [references/04-micro-interactions.md](references/04-micro-interactions.md): Micro-Interactions, 44 animations. Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns.- [references/05-text-typography.md](references/05-text-typography.md): Text & Typography, 19 animations. Animations specifically for type — kinetic motion, character-level effects, gradient flows, and word transformations.-- [references/06-3d-advanced.md](references/06-3d-advanced.md): 3D & Advanced, 26 animations. WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects.+- [references/06-3d-advanced.md](references/06-3d-advanced.md): 3D & Advanced, 27 animations. WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects.- [references/07-ambient-background.md](references/07-ambient-background.md): Ambient & Background, 23 animations. Passive, looping effects that hold visual interest without demanding attention — gradients, particles, grain, and glows.Each live demo address is also the technique's folder in https://github.com/matinmonshizadeh/animation-handbook; read its README (the address followed by README.md) only when the user asks how a technique works.diff --git a/skills/animation-handbook/references/06-3d-advanced.md b/skills/animation-handbook/references/06-3d-advanced.mdindex ba7c4aed..07a6dccb 100644--- a/skills/animation-handbook/references/06-3d-advanced.md+++ b/skills/animation-handbook/references/06-3d-advanced.md@@ -1,6 +1,6 @@# 06 · 3D & Advanced-WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects. 26 animations from Animation Handbook, in the home page's order. Each entry gives the live demo, how it runs, what it is good for and what to avoid it on, the prompt from its page word for word, and its settings with what each does and the demo's values.+WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects. 27 animations from Animation Handbook, in the home page's order. Each entry gives the live demo, how it runs, what it is good for and what to avoid it on, the prompt from its page word for word, and its settings with what each does and the demo's values.## Contents@@ -30,6 +30,7 @@ WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects- [Liquid Glass](#liquid-glass)- [Holographic Card](#holographic-card)- [Infinite Zoom](#infinite-zoom)+- [Water Ripple](#water-ripple)## 3D Model Orbit@@ -571,3 +572,23 @@ Add an infinite zoom to [the section you want it in]. Give each picture, such as- Number of scenes: 1 · 3 · **5**. How many different pictures take turns: one picture holds a copy of itself; three are the gallery, the drive-in and the living room; five add the desk and the photo on a table.- Direction: **In** · Out. In dives into each picture's window; out pulls back, so each picture shrinks into the window of the one around it.- Shows the scene edges: on · **off**. Outlines the edge of every picture with a dashed line and numbers the ones big enough to read by their place in the chain, so you can see each one grow to the edges of the box and take over.++## Water Ripple++Ripples spread from your finger and bend the picture below. Best for hero images.++- Live demo: https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/+- How it runs: reacts to the visitor+- Good for: Hero pictures · Pool, spa and travel sites · Playful backgrounds+- Avoid on: Pictures with text · Busy pages++**Prompt**++Add a water ripple effect to [the picture you want to look as if it lies under water]. Keep two grids of water heights, now and one step earlier. On each step, set every point to half the total of its four neighbors minus its earlier height, then damp it slightly, so ripples spread, cross, bounce off the edges and fade. A finger or mouse drag leaves a trail of small pushes without scrolling the page; a tap drops a pebble. Draw the picture shifted at each point by the slope of the water, so it bends under the waves. Use a coarse grid and fixed steps, and stop once the water is calm. Under reduced motion, show still rings that fade. Match the settings listed below.++**Settings** (the choice in bold is where the demo starts; each line ends with what the setting does, with the demo's values):++- Ripple size: Small · **Medium** · Large. How wide each push is, in grid points of a full-size grid: small is 2, medium 3.5 and large 5.5 (a tap's pebble is half as wide again).+- How long ripples last: Short · **Medium** · Long. How much height the water loses each step: short is 5%, which fades a pebble's rings within a second; medium 2.2%, about three seconds; long 0.9%, long enough for rings to bounce off the edges and cross.+- Bend: Subtle · **Medium** · Strong. How far the picture under a slope is shifted: subtle is 5 grid points for a full slope, medium 12 and strong 22.+- Light on the waves: **on** · off. Slopes that face the light show a lighter picture, in three steps of brightness; off, only the bending shows.diff --git a/skills/animation-handbook/references/catalog.md b/skills/animation-handbook/references/catalog.mdindex 45e8fee2..fb7124d9 100644--- a/skills/animation-handbook/references/catalog.md+++ b/skills/animation-handbook/references/catalog.md@@ -1,6 +1,6 @@# Catalog-All 171 animations of Animation Handbook, in the home page's order and grouped by category. Each line gives the name linked to its live demo, what it does and what it is best for, and its places (the parts of a page it suits, the main one first). The category folder in the address names the file that holds its full entry, with the prompt and the settings.+All 172 animations of Animation Handbook, in the home page's order and grouped by category. Each line gives the name linked to its live demo, what it does and what it is best for, and its places (the parts of a page it suits, the main one first). The category folder in the address names the file that holds its full entry, with the prompt and the settings.Contents: [01 · Scroll-Based](#01--scroll-based) · [02 · Entrance & Exit](#02--entrance--exit) · [03 · Page Transitions](#03--page-transitions) · [04 · Micro-Interactions](#04--micro-interactions) · [05 · Text & Typography](#05--text--typography) · [06 · 3D & Advanced](#06--3d--advanced) · [07 · Ambient & Background](#07--ambient--background) · [By place](#by-place)@@ -153,7 +153,7 @@ Animations specifically for type — kinetic motion, character-level effects, gr## 06 · 3D & Advanced-WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects. 26 animations, in [06-3d-advanced.md](06-3d-advanced.md).+WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects. 27 animations, in [06-3d-advanced.md](06-3d-advanced.md).- [3D Model Orbit](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/3d-model-orbit/): A lit 3D shape spins, or turns to face your pointer. Best for product views. Places: Images & cards.- [Scroll-Driven 3D Rotation](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/scroll-driven-3d-rotation/): Scrolling turns a 3D cube from pose to pose. Best for product tours. Places: Scrolling, Images & cards.@@ -181,6 +181,7 @@ WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects- [Liquid Glass](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/liquid-glass/): Drag a glass panel and the picture behind it bends at the edges. Best for cards. Places: Images & cards, Menus & forms.- [Holographic Card](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/holographic-card/): A card tilts as you point, and its rainbow foil shimmers. Best for collectibles. Places: Images & cards.- [Infinite Zoom](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/infinite-zoom/): The view keeps zooming into pictures inside pictures. Best for page intros. Places: Page intros, Backgrounds.+- [Water Ripple](https://matinmonshizadeh.github.io/animation-handbook/animations/06-3d-advanced/water-ripple/): Ripples spread from your finger and bend the picture below. Best for hero images. Places: Backgrounds, Images & cards.## 07 · Ambient & Background@@ -216,8 +217,8 @@ The home page's places, each with the animations that suit it.- **Buttons** (22): Hover State Animation, Click / Tap Ripple, Button Press Scale, Magnetic Button, Toggle / Switch Slide, Heart / Like Burst, Success Confetti, Notification Badge Pulse, Tooltip Reveal, Modal Expand, Hamburger Menu Toggle, Theme Toggle Morph, Copy to Clipboard, Star Rating, Segmented Control, Animated Gradient Border, Spotlight Hover Glow, Add-to-Cart Fly, Hold to Confirm, Expanding Search, Button Loading States, Gooey Menu- **Text** (27): Counter Animation, Text Fill on Scroll, Slide Up Reveal, Split Text Reveal, Letter-by-Letter Stagger, Word-by-Word Reveal, Rolling Numbers, Kinetic Typography, Typewriter Effect, Scramble / Glitch Text, Variable Font Morph, Text Clip-Path Reveal, Marquee / Ticker, Text Morphing, Text Gradient Animation, Outline to Fill, Enter/Exit Typography, Rotate Word Carousel, Glitch Text, Text on a Path, Wavy Text, Highlighter Sweep, Split-Flap Board, Neon Flicker, Handwriting Draw, Text Particles, Chromatic Aberration-- **Images & cards** (49): Parallax Depth-of-Field, Parallax Scrolling, Reverse-Scrolling Columns, Stacking Cards, Snap Scrolling, Reveal on Scroll, Stagger Reveal, Horizontal Scroll, Zoom Into Image, Scroll Image Sequence, Scroll Velocity Skew, Clip-Path Reveal, Blur In, Flip In, Shatter Effect, Ink Spread Reveal, Shared Element Transition, Blur Transition, Dissolve Transition, FLIP Technique, Page Curl, Cube Transition, Pixelate Transition, Hover State Animation, Skeleton Loader, Modal Expand, Swipe to Dismiss, Animated Gradient Border, Spotlight Hover Glow, Image Trail, Before/After Slider, Magnifier Lens, Card Deck Swipe, 3D Model Orbit, Scroll-Driven 3D Rotation, Parallax 3D Tilt, Glassmorphism Animated, SVG Path Animation, 2.5D / Pseudo-3D, Image Distortion on Hover, Cloth / Soft-Body Simulation, 3D Flip Card, 3D Carousel, Depth-Map Photo, ASCII / Halftone, Liquid Glass, Holographic Card, Grain / Film Noise Overlay, Light Leak-- **Backgrounds** (39): Scroll-Driven Background Color, Cursor Follower, Neon Flicker, Canvas Particle Effect, Fluid / Liquid Simulation, Glassmorphism Animated, WebGL Shader Animation, Noise-Based Motion, Ray Marching / SDF Scene, GPGPU Particle System, Volumetric Smoke / 3D Noise, Morphing Blob, Flocking, ASCII / Halftone, 2D Physics, Infinite Zoom, Animated Gradient Background, Mesh Gradient Animation, Aurora / Northern Lights, Grain / Film Noise Overlay, Scanline Effect, Light Leak, Starfield / Space Particles, Breathing / Pulsing Glow, Ambient Ripple Effect, Floating Elements, Grid / Dot Pattern Parallax, Abstract Geometric Motion, Particle Constellation, Flow Field, Synthwave Grid, Matrix Rain, Plasma Field, Wave Layers, Snow / Rain, Fireworks, Topographic Lines, Light Rays, Game of Life+- **Images & cards** (50): Parallax Depth-of-Field, Parallax Scrolling, Reverse-Scrolling Columns, Stacking Cards, Snap Scrolling, Reveal on Scroll, Stagger Reveal, Horizontal Scroll, Zoom Into Image, Scroll Image Sequence, Scroll Velocity Skew, Clip-Path Reveal, Blur In, Flip In, Shatter Effect, Ink Spread Reveal, Shared Element Transition, Blur Transition, Dissolve Transition, FLIP Technique, Page Curl, Cube Transition, Pixelate Transition, Hover State Animation, Skeleton Loader, Modal Expand, Swipe to Dismiss, Animated Gradient Border, Spotlight Hover Glow, Image Trail, Before/After Slider, Magnifier Lens, Card Deck Swipe, 3D Model Orbit, Scroll-Driven 3D Rotation, Parallax 3D Tilt, Glassmorphism Animated, SVG Path Animation, 2.5D / Pseudo-3D, Image Distortion on Hover, Cloth / Soft-Body Simulation, 3D Flip Card, 3D Carousel, Depth-Map Photo, ASCII / Halftone, Liquid Glass, Holographic Card, Water Ripple, Grain / Film Noise Overlay, Light Leak+- **Backgrounds** (40): Scroll-Driven Background Color, Cursor Follower, Neon Flicker, Canvas Particle Effect, Fluid / Liquid Simulation, Glassmorphism Animated, WebGL Shader Animation, Noise-Based Motion, Ray Marching / SDF Scene, GPGPU Particle System, Volumetric Smoke / 3D Noise, Morphing Blob, Flocking, ASCII / Halftone, 2D Physics, Infinite Zoom, Water Ripple, Animated Gradient Background, Mesh Gradient Animation, Aurora / Northern Lights, Grain / Film Noise Overlay, Scanline Effect, Light Leak, Starfield / Space Particles, Breathing / Pulsing Glow, Ambient Ripple Effect, Floating Elements, Grid / Dot Pattern Parallax, Abstract Geometric Motion, Particle Constellation, Flow Field, Synthwave Grid, Matrix Rain, Plasma Field, Wave Layers, Snow / Rain, Fireworks, Topographic Lines, Light Rays, Game of Life- **Menus & forms** (20): Cover Card to Fixed Header, Scrollspy Navigation, Hide-on-Scroll Header, Slide In, Scale In / Zoom In, Focus Ring Animation, Toggle / Switch Slide, Checkmark Draw, Form Field Morph, Drawer / Panel Slide, Accordion Open/Close, Error Shake, Hamburger Menu Toggle, Star Rating, Segmented Control, Drag to Reorder, Expanding Search, Gooey Menu, Dynamic Island, Liquid Glass- **Loading & messages** (20): Progress Bar, Slide In, Bounce In, Heart / Like Burst, Success Confetti, Skeleton Loader, Shimmer Effect, Loading Spinner, Progress Animation, Checkmark Draw, Notification Badge Pulse, Error Shake, Copy to Clipboard, Toast Notification, Pull to Refresh, Rolling Numbers, Typing Indicator, Button Loading States, Dynamic Island, Breathing / Pulsing Glow- **Page intros** (29): Fade In / Fade Out, Slide In, Slide Up Reveal, Scale In / Zoom In, Clip-Path Reveal, Curtain Reveal, Split Text Reveal, Letter-by-Letter Stagger, Word-by-Word Reveal, Blur In, Flip In, Bounce In, Rotate In, Ink Spread Reveal, Image Trail, Kinetic Typography, Typewriter Effect, Text Clip-Path Reveal, Enter/Exit Typography, Split-Flap Board, Handwriting Draw, Text Particles, SVG Path Animation, Depth-Map Photo, 2D Physics, Infinite Zoom, Wave Layers, Fireworks, Light Raysdiff --git a/tests/pages.test.js b/tests/pages.test.jsindex 367f8dda..41755e09 100644--- a/tests/pages.test.js+++ b/tests/pages.test.js@@ -414,7 +414,7 @@ test("on phones the mode switch's own rule outranks the rule for choice buttons,const KEYBOARD_PAGES = {'04-micro-interactions': ['cursor-follower', 'hover-state', 'image-trail', 'spotlight-hover', 'magnetic-button', 'click-ripple', 'before-after-slider', 'magnifier-lens', 'card-deck-swipe'],'05-text-typography': ['text-particles'],- '06-3d-advanced': ['2-5d-pseudo-3d', 'depth-map-photo', 'holographic-card', 'image-distortion-hover', 'parallax-3d-tilt']+ '06-3d-advanced': ['2-5d-pseudo-3d', 'depth-map-photo', 'holographic-card', 'image-distortion-hover', 'parallax-3d-tilt', 'water-ripple']};test('the do-it pages played with the pointer can be played from the keyboard', () => {const problems = [];