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: Before/After Slider (04.42), a new Micro-Interactions page
matin2783b7e535c8
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.ymlindex 03213774..1e8676d9 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 168 techniques running before filing an issue.+ about: See all 169 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 644430eb..f62412d3 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 168 animations</a>+ <a class="way" href="/animation-handbook/?view=all#results">Browse all 169 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 d2f3757f..bccf7cb7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -19,6 +19,8 @@ The main steps of Animation Handbook, newest first, with the number of animationCompare from the start.- A new animation, Pixelate Transition (168 in all): the page breaks into big pixels, then sharpens into the next, withSee inside and Compare from the start.+- A new animation, Before/After Slider (169 in all): drag a line across two pictures to compare them, with See inside and+ Compare from the start.## 1.0.0 — 2026-10-10diff --git a/README.md b/README.mdindex a90700dc..63c57a65 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 168 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 169 web animation techniques" width="820"></picture></a># Animation Handbook-**A visual reference of 168 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 169 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 168 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 169 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.@@ -62,14 +62,14 @@ Then ask for an animation in plain words, like "make the cards fade in as they s| 01 | [Scroll-Based](#01) | 27 || 02 | [Entrance & Exit](#02) | 15 || 03 | [Page Transitions](#03) | 17 |-| 04 | [Micro-Interactions](#04) | 41 |+| 04 | [Micro-Interactions](#04) | 42 || 05 | [Text & Typography](#05) | 19 || 06 | [3D & Advanced](#06) | 26 || 07 | [Ambient & Background](#07) | 23 |## Full catalog-All 168 techniques, each linked to its live demo.+All 169 techniques, each linked to its live demo.Each technique's code and README are in its folder under [animations/](animations/).@@ -167,11 +167,11 @@ Each technique's code and README are in its folder under [animations/](animation<a id="04"></a>-### 04 · Micro-Interactions · 41 techniques+### 04 · Micro-Interactions · 42 techniques<sub>Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns.</sub>-<details><summary>Browse all 41 techniques in Micro-Interactions</summary>+<details><summary>Browse all 42 techniques in Micro-Interactions</summary>- **[Hover State Animation](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/hover-state/)** — Six ways a card can react when you point at it. Best for buttons and cards.- **[Click / Tap Ripple](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/click-ripple/)** — A ripple spreads out from the spot you press. Best for buttons and list items.@@ -214,6 +214,7 @@ Each technique's code and README are in its folder under [animations/](animation- **[Image Trail](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/image-trail/)** — Pictures pop up in a trail behind your pointer, then fade. Best for portfolios.- **[Gooey Menu](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/gooey-menu/)** — Small buttons ooze out of a round button like liquid. Best for quick actions.- **[Dynamic Island](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/dynamic-island/)** — A black pill grows into a notification, then shrinks back. Best for live updates.+- **[Before/After Slider](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/)** — Drag a line across two pictures to compare them. Best for photo edits.</details>diff --git a/animations/04-micro-interactions/README.md b/animations/04-micro-interactions/README.mdindex c2b07a0c..4b7760f7 100644--- a/animations/04-micro-interactions/README.md+++ b/animations/04-micro-interactions/README.md@@ -47,6 +47,7 @@ Short, user-triggered animations that provide feedback, confirm actions, and com| [Image Trail](image-trail/) | Pictures pop up in a trail behind your pointer, then fade. Best for portfolios. || [Gooey Menu](gooey-menu/) | Small buttons ooze out of a round button like liquid. Best for quick actions. || [Dynamic Island](dynamic-island/) | A black pill grows into a notification, then shrinks back. Best for live updates. |+| [Before/After Slider](before-after-slider/) | Drag a line across two pictures to compare them. Best for photo edits. |## Key conceptsdiff --git a/animations/04-micro-interactions/before-after-slider/README.md b/animations/04-micro-interactions/before-after-slider/README.mdnew file mode 100644index 00000000..9ee70145--- /dev/null+++ b/animations/04-micro-interactions/before-after-slider/README.md@@ -0,0 +1,53 @@+# Before/After Slider++[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/)++## What it is+A before/after slider stacks two pictures of the same scene, such as a photo before and after an edit, and shows the top one only up to a dividing line. Dragging the line uncovers more of one picture and less of the other, so the eye can compare the same spot in both. Neither picture moves: only the line does.++## When to use it+- Photo edits and retouching, the original beside the result+- Website and app redesigns, the old screen against the new one+- Renovations, restorations and cleanups+- Product upgrades, such as a new screen or a better camera+- Maps and aerial views of one place at two dates++## How it works+Both pictures fill the same box. Before lies whole underneath. After sits in a window as big as the box, and one number from 0 to 1 says how much of it shows. The window slides with the line and the picture inside it slides back by the same amount, so it stays exactly over Before; all three moves are transforms, so a drag redraws nothing:++```css+.win { overflow: hidden; transform: translateX(calc((var(--v) - 1) * 100%)); }+.win .pic { transform: translateX(calc((1 - var(--v)) * 100%)); }+.rail { transform: translateX(calc(var(--v) * 100%)); } /* the line and its handle */+```++Pointer events turn the pointer's place into that number, with pointer capture so a drag keeps working outside the box:++```js+const r = front.getBoundingClientRect();+const v = Math.min(1, Math.max(0, (e.clientX - r.left) / r.width));+for (const el of movers) el.style.setProperty('--v', v); // the window, its picture and the line+```++A press that does not move glides the line to it, eased by the time that passes. The handle is a slider whose value is read as "60% After": the arrow keys move it a twentieth, Page Up and Page Down a quarter, Home and End to the ends. With Left and right the pictures keep `touch-action: pan-y`, so an up-and-down swipe still scrolls the page; with Top and bottom only the handle starts a drag, for the same reason. The Before and After labels fade when the line comes over them. Under reduced motion the line jumps instead of gliding.++## Key parameters+| Parameter | Default | Effect |+|-----------|---------|--------|+| Split | Left and right | Which way the line runs: left and right shows After to the left of an upright line, dragged anywhere on the pictures; top and bottom shows After below a level line, dragged by its handle only |+| Handle | Knob | What there is to grab: knob is a round button with two arrows, bar a narrow bar along the line, line only the bare line (still grabbed across a strip about as wide as a fingertip) |+| Shows labels | on | Before and After name each side from a corner, and each fades out when the line comes within a few pixels of it |++## Production notes+- **Uncover, never resize.** Shrinking the top picture's width squeezes it, and changing width forces layout on every move. A sliding window with the picture slid back, or `clip-path: inset(0 calc((1 - var(--v)) * 100%) 0 0)` on the top picture, keeps both pictures still; clip-path is shorter to write but repaints the top picture on each move.+- **Set the number where it is used.** A property that changes on every move and sits on a parent makes the browser restyle everything inside it, a picture drawn in SVG included. Set it on the parts that move instead, and register it with `@property --v { syntax: "<number>"; inherits: false; initial-value: 0.5; }` so it stays there; on this page that was the main cost of a drag on a slow processor.+- **Same size, same framing.** Both pictures need exactly the same size and crop (`object-fit: cover` on both); a few pixels of offset reads as a wobble when the line moves.+- **Phones.** `touch-action: pan-y` on the pictures leaves up-and-down scrolling to the browser. A finger that starts moving up and down is a scroll, so let go of it at once, or the line jumps to the finger before the browser takes over; a `pointercancel` means the browser took the gesture over, so stop the drag there.+- **Accessibility.** Give the handle `role="slider"`, `aria-valuenow` and an `aria-valuetext` such as "60% After", handle the arrow, Page Up, Page Down, Home and End keys, and give the pictures their own alternative text.+- **Libraries.** The img-comparison-slider web component, juxtapose.js and TwentyTwenty (jQuery) package the same idea; in an app, GSAP's Draggable or Framer Motion's `drag` can move the line.+- **Reduced motion.** Let the line jump to a tap or a key press instead of gliding.++## See also+- [Swipe to Dismiss](../swipe-to-dismiss/) — a drag that follows the finger and springs back+- [Liquid Glass](../../06-3d-advanced/liquid-glass/) — a glass panel dragged over a picture, arrow keys too+- [Clip-Path Reveal](../../02-entrance-and-exit/clip-path-reveal/) — a shape uncovers a picture once, by itselfdiff --git a/animations/04-micro-interactions/before-after-slider/index.html b/animations/04-micro-interactions/before-after-slider/index.htmlnew file mode 100644index 00000000..6fc9e940--- /dev/null+++ b/animations/04-micro-interactions/before-after-slider/index.html@@ -0,0 +1,381 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Before/After Slider — Animation Handbook</title>+ <meta name="description" content="Drag a line across two pictures to compare them. Best for photo edits.">+ <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/">+ <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="Before/After Slider — Animation Handbook">+ <meta property="og:description" content="Drag a line across two pictures to compare them. Best for photo edits.">+ <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/">+ <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="Before/After Slider — Animation Handbook">+ <meta name="twitter:description" content="Drag a line across two pictures to compare them. Best for photo edits.">+ <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": "Before/After Slider", "name": "Before/After Slider", "description": "Drag a line across two pictures to compare them. Best for photo edits.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/", "inLanguage": "en", "articleSection": "Micro-Interactions", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Micro-Interactions, Before/After Slider"}</script>+ <style>+ :root{--ui-accent:#ff9d5c}+ *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}+ /* --v: how much of After shows, 0 to 1 (the line's place from the left, or from the bottom in Top and bottom). It is set on the parts+ that use it and does not inherit, so a move re-styles those parts and not everything drawn inside them */+ @property --v{syntax:"<number>";inherits:false;initial-value:.5}+ .stage{position:relative;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);background:#0b0b0d;-webkit-user-select:none;user-select:none}+ .defs{position:absolute;width:0;height:0;overflow:hidden}+ .ba{position:relative;min-width:0;overflow:hidden;touch-action:pan-y;cursor:ew-resize}+ .vert .ba{cursor:pointer}+ .layer,.win,.pic,.rail{position:absolute;inset:0}+ .pic svg{display:block;width:100%;height:100%}+ /* Before lies whole underneath, gray and flat. After sits in a window that slides with the line, and its picture slides back+ by the same amount, so it never moves: two transforms, nothing redrawn */+ .before{filter:grayscale(1) contrast(.72) brightness(1.08)}+ .win{overflow:hidden;transform:translateX(calc((var(--v) - 1) * 100%));will-change:transform}+ .win .pic{transform:translateX(calc((1 - var(--v)) * 100%));will-change:transform}+ .vert .win{transform:translateY(calc((1 - var(--v)) * 100%))}+ .vert .win .pic{transform:translateY(calc((var(--v) - 1) * 100%))}+ .rail{pointer-events:none;transform:translateX(calc(var(--v) * 100%));will-change:transform}+ .vert .rail{transform:translateY(calc((1 - var(--v)) * 100%))}+ .line{position:absolute;left:-1px;top:0;bottom:0;width:2px;background:#fff;box-shadow:0 0 0 1px rgba(0,0,0,.25)}+ .vert .line{left:0;right:0;top:-1px;bottom:auto;width:auto;height:2px}+ /* The handle: a slider the keyboard can move too, at least 48px to touch whatever its look */+ .handle{position:absolute;left:0;top:50%;width:48px;height:48px;margin:-24px 0 0 -24px;display:grid;place-items:center;border-radius:24px;pointer-events:auto;cursor:grab;touch-action:none}+ .vert .handle{left:50%;top:0}+ .h-bar .handle{height:68px;margin-top:-34px}+ .vert.h-bar .handle{width:68px;height:48px;margin:-24px 0 0 -34px}+ .grip{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:#fff;color:#16161a;box-shadow:0 2px 10px rgba(0,0,0,.4)}+ .grip svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}+ .vert .grip svg{transform:rotate(90deg)}+ .h-bar .grip{width:12px;height:60px;border-radius:6px}+ .vert.h-bar .grip{width:60px;height:12px}+ .h-bar .grip svg,.h-line .grip{opacity:0}+ .tag{position:absolute;top:10px;padding:4px 10px;border-radius:999px;background:rgba(11,11,13,.78);color:#f4f4f2;font:600 13px/1.2 var(--hb-font);transition:opacity .25s}+ .tag-a{left:10px}.tag-b{right:10px}+ .vert .tag-b{right:auto;left:10px}.vert .tag-a{top:auto;bottom:10px}+ .tag.gone,.no-tags .tag{opacity:0}+ /* See inside and Compare: plain words over the stage; in See inside the two pictures pulled apart, Before at the back and+ After in front, its hidden part faint and its window dashed */+ .ghost,.twin,.cap{display:none}+ .cap{position:absolute;z-index:3;padding:3px 8px;border-radius:6px;background:rgba(11,11,13,.9);color:#f4f4f2;font:600 13px/1.25 var(--hb-font);white-space:nowrap;pointer-events:none}+ .stage[data-hb-mode="inside"] .cap.in,.stage[data-hb-mode="compare"] .cap.half{display:block}+ .stage[data-hb-mode="inside"] .ghost{display:block;opacity:.3}+ .stage[data-hb-mode="inside"] .layer{outline:2px solid rgba(255,255,255,.4)}+ .stage[data-hb-mode="inside"] .back{transform:translate(-9%,-9%) scale(.62)}+ .stage[data-hb-mode="inside"] .front{overflow:hidden;transform:translate(9%,9%) scale(.62);box-shadow:0 18px 40px rgba(0,0,0,.65)}+ .stage[data-hb-mode="inside"] .win::after{content:"";position:absolute;inset:0;border:4px dashed var(--ui-accent)}+ .stage[data-hb-mode="inside"] .tag{font-size:20px}+ .stage[data-hb-mode="inside"] .tag-b{display:none}+ .stage[data-hb-mode="inside"] .handle{transform:scale(1.62)}+ /* Compare: a copy whose After picture is resized with the line beside the real one, which uncovers it; one line drives both.+ Their names sit in a strip under them, clear of the Before and After labels */+ .stage[data-hb-mode="compare"]{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr) 36px;column-gap:4px}+ .stage[data-hb-mode="compare"] .twin{display:block}+ .twin .win{transform:none}+ .twin .after{transform:scaleX(var(--v));transform-origin:0 50%}+ .vert .twin .after{transform:scaleY(var(--v));transform-origin:50% 100%}+ .cap.half{bottom:6px}.cap.first{left:8px}.cap.second{left:calc(50% + 10px)}+ @media(prefers-reduced-motion:reduce){.tag{transition:none}}+ </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="../dynamic-island/" rel="prev" aria-label="Previous: Dynamic Island"><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>Dynamic Island</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">04.42 · Micro-Interactions</p>+ <h1>Before/After Slider</h1>+ <p class="hb-lede">Drag a line across two pictures to compare them. Best for photo edits.</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 the line, 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">+ <svg class="defs" aria-hidden="true"><defs>+ <linearGradient id="ba-sky" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2b3f8f"/><stop offset=".6" stop-color="#f08a6c"/><stop offset="1" stop-color="#ffd18a"/></linearGradient>+ <linearGradient id="ba-sea" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#2a9d9b"/><stop offset="1" stop-color="#0f3b57"/></linearGradient>+ <!-- A made-up harbor at dusk: a sun, hills, a lighthouse, houses on the shore, a pier and two boats -->+ <symbol id="ba-harbor" viewBox="0 0 800 500">+ <rect width="800" height="330" fill="url(#ba-sky)"/>+ <circle cx="400" cy="200" r="60" fill="#ffe7a8"/>+ <path d="M0 296 120 236 214 280 330 222 470 288 560 256 680 300 800 262V332H0Z" fill="#5b4a8c"/>+ <rect y="326" width="800" height="174" fill="url(#ba-sea)"/>+ <path d="M346 348h108M364 366h72M378 384h44M390 402h20" stroke="#ffe7a8" stroke-width="6" stroke-linecap="round" opacity=".85"/>+ <path d="M0 326H268L238 356H0Z" fill="#3a2d29"/>+ <path d="M20 326V282L52 256 84 282V326ZM96 326V292L126 268 156 292V326ZM168 326V286L196 262 224 286V326Z" fill="#e85d4a"/>+ <path d="M96 292 126 268 156 292ZM20 282 52 256 84 282Z" fill="#2c3e78"/>+ <path d="M40 296h12v12H40ZM116 300h12v12h-12ZM186 296h12v12h-12Z" fill="#ffd36e"/>+ <path d="M236 352H330V362H236Z" fill="#7a5235"/><path d="M250 362h6v26h-6ZM288 362h6v26h-6ZM320 362h6v26h-6Z" fill="#5a3a24"/>+ <path d="M580 330C596 300 664 296 700 330Z" fill="#2e2a3a"/><path d="M624 314V214H658V314Z" fill="#f4f1ea"/>+ <path d="M624 240H658V256H624ZM624 278H658V294H624Z" fill="#e0453a"/><path d="M618 214H664L641 190Z" fill="#e0453a"/><rect x="629" y="198" width="24" height="16" fill="#ffe7a8"/>+ <path d="M470 388H570L552 408H488Z" fill="#d6453d"/><path d="M518 386V316L566 384Z" fill="#fbf7ee"/>+ <path d="M150 404H222L210 418H162Z" fill="#f2b33d"/><path d="M184 402V356L218 400Z" fill="#fbf7ee"/>+ <path d="M250 128q12-10 24 0q12-10 24 0M318 104q9-8 18 0q9-8 18 0" fill="none" stroke="#2a2342" stroke-width="4" stroke-linecap="round"/>+ </symbol>+ </defs></svg>+ <div class="ba" id="ba">+ <div class="layer back">+ <div class="pic before" id="before-pic" role="img" aria-label="A harbor at dusk, half the gray original and half the edited picture in full color, split by a line you can drag"><svg viewBox="0 0 800 500" preserveAspectRatio="xMidYMid slice"><use href="#ba-harbor" width="800" height="500"/></svg></div>+ <span class="tag tag-b" aria-hidden="true">Before</span>+ </div>+ <div class="layer front">+ <div class="pic ghost" aria-hidden="true"><svg viewBox="0 0 800 500" preserveAspectRatio="xMidYMid slice"><use href="#ba-harbor" width="800" height="500"/></svg></div>+ <div class="win"><div class="pic after" aria-hidden="true"><svg viewBox="0 0 800 500" preserveAspectRatio="xMidYMid slice"><use href="#ba-harbor" width="800" height="500"/></svg></div></div>+ <span class="tag tag-a" aria-hidden="true">After</span>+ <div class="rail"><span class="line"></span><div class="handle" id="handle" role="slider" tabindex="0" aria-label="Before and after" aria-orientation="horizontal" aria-valuemin="0" aria-valuemax="100" aria-valuenow="50" aria-valuetext="50% After"><span class="grip"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m9 7-5 5 5 5M15 7l5 5-5 5"/></svg></span></div></div>+ </div>+ </div>+ <p class="cap in" id="c-before" aria-hidden="true" data-hb-caption>Before · whole, underneath</p>+ <p class="cap in" id="c-after" aria-hidden="true" data-hb-caption>After · shows only in the window</p>+ <p class="cap in" id="c-win" aria-hidden="true" data-hb-caption>Window · slides with the line</p>+ <p class="cap half first" aria-hidden="true" data-hb-caption>Resizes it</p>+ <p class="cap half second" aria-hidden="true" data-hb-caption>Uncovers it</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>Inside, Before lies whole underneath and After sits in front, showing only inside its dashed window. The window slides with the line, while the picture in it stays put.</p>+ <p data-hb-for="compare" hidden>On the left the colored picture is resized with the line, so it squeezes. On the right it is only uncovered, so both pictures stay put.</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 line or press Show me.</p></div>+ </div>+ <div class="hb-settings">+ <div class="hb-setting">+ <p class="hb-setting-name" id="split-lbl">Split</p>+ <div class="seg" id="split-seg" role="group" aria-labelledby="split-lbl">+ <button type="button" data-split="lr" class="on" aria-pressed="true">Left and right</button>+ <button type="button" data-split="tb" aria-pressed="false">Top and bottom</button>+ </div>+ <p class="hb-hint">Which way the line runs.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="handle-lbl">Handle</p>+ <div class="seg" id="handle-seg" role="group" aria-labelledby="handle-lbl">+ <button type="button" data-h="knob" class="on" aria-pressed="true">Knob</button>+ <button type="button" data-h="bar" aria-pressed="false">Bar</button>+ <button type="button" data-h="line" aria-pressed="false">Line only</button>+ </div>+ <p class="hb-hint">A knob tells people they can drag.</p>+ </div>+ <div class="hb-setting">+ <label class="hb-switch-row"><span>Shows labels</span><input class="hb-switch" type="checkbox" role="switch" id="tags-tog" checked autocomplete="off"></label>+ <p class="hb-hint">Before and After fade as the line covers them.</p>+ </div>+ </div>+ </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 before-and-after slider to [the two pictures you want to compare]. Stack the pictures exactly on top of each other and show the top one only up to a dividing line with a handle, so each side of the line shows one picture. Dragging on the pictures moves the line, and a tap jumps it there. Uncover the top picture with a clip or a sliding window, never by resizing it, so neither picture moves or squeezes. Use pointer events for mouse and touch, keep page scrolling free on phones, and let the arrow keys move the handle. If the visitor has reduced motion turned on, move the line without gliding. 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>Photo edits</li><li>Redesigns</li><li>Renovations</li><li>Product upgrades</li></ul>+ <h3>Avoid on</h3>+ <ul class="hb-tags hb-avoid"><li>Small thumbnails</li><li>Unrelated pictures</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 stage=document.querySelector('.stage'),ba=document.getElementById('ba'),back=ba.querySelector('.back'),front=ba.querySelector('.front');+ const handle=document.getElementById('handle'),pic=document.getElementById('before-pic'),slowTog=document.getElementById('slow-tog');+ const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),caps=['c-before','c-after','c-win'].map(id=>document.getElementById(id));+ const LABELS={normal:pic.getAttribute('aria-label'),+ inside:'The two pictures pulled apart: the gray original whole at the back, the edited one in front, showing only in its window',+ compare:'The same split twice: the edited picture squeezed into the space beside the line, then only uncovered by it'};+ // v: how much of After shows (0 to 1); aim: where the line is going (a glide's end, or v)+ // runTo: where a Show me run ends (where the run began; in a view the pose, and the middle again once Normal takes the pose away)+ // posed: the view holds the line at its pose; fin: the run's way back is moving+ let v=.5,aim=.5,runTo=.5,mode='normal',posed=false,fin=false,twin=null,movers=[],glideRaf=0,demo=false,runTimers=[],drag=null;+ const isVert=()=>stage.classList.contains('vert'),middle=x=>Math.abs(x-.5)<1e-6;++ // Everything that needs a measurement is read first and written after, so a frame of a glide lays out once+ function setV(x){+ v=Math.min(1,Math.max(0,x));+ const tags=tagStates(),at=mode==='inside'?capPlaces():null;+ movers.forEach(m=>m.style.setProperty('--v',v));+ const pct=Math.round(v*100);handle.setAttribute('aria-valuenow',pct);handle.setAttribute('aria-valuetext',pct+'% After');+ tags.forEach(t=>t[0].classList.toggle('gone',t[1]));+ if(at)caps.forEach((c,i)=>{ // only a label that moved is written again: most stay put while the line moves+ const x=Math.round(at[i][0]*10)/10+'px',y=Math.round(at[i][1]*10)/10+'px';+ if(c.style.left!==x)c.style.left=x;if(c.style.top!==y)c.style.top=y;+ });+ }+ // Before and After fade while the line covers them, on the real pictures and, in Compare, on the copy+ function tagStates(){+ const vert=isVert(),out=[];+ stage.querySelectorAll('.ba').forEach(f=>{+ const a=f.querySelector('.tag-a'),b=f.querySelector('.tag-b'),size=vert?f.clientHeight:f.clientWidth,at=vert?(1-v)*size:v*size;+ if(size)out.push([a,vert?at>a.offsetTop-8:at<a.offsetLeft+a.offsetWidth+8],[b,vert?at<b.offsetTop+b.offsetHeight+8:at>b.offsetLeft-8]);+ });+ return out;+ }+ // The line glides to a place by the time that passes (three times as long in slow motion); under reduced motion it jumps+ function glide(to,ms,then){+ cancelAnimationFrame(glideRaf);glideRaf=0;aim=Math.min(1,Math.max(0,to));+ if(reduceMQ.matches){setV(aim);if(then)then();return}+ const from=v,dur=ms*(slowTog.checked?3:1);let t0=null;+ const step=ts=>{+ if(t0===null)t0=ts;+ const k=reduceMQ.matches?1:Math.min(1,(ts-t0)/dur);+ setV(k<1?from+(aim-from)*k*k*(3-2*k):aim);+ if(k<1)glideRaf=requestAnimationFrame(step);else{glideRaf=0;if(then)then()}+ };+ glideRaf=requestAnimationFrame(step);+ }+ // Show me: to 80%, to 20% and back to where it started; every pause waits on a timer, and slow motion triples the moves only+ function later(fn,move,hold){const id=setTimeout(()=>{runTimers=runTimers.filter(t=>t!==id);fn()},move*(slowTog.checked?3:1)+hold);runTimers.push(id)}+ function stopRun(){runTimers.forEach(clearTimeout);runTimers=[];if(demo){cancelAnimationFrame(glideRaf);glideRaf=0;aim=v}demo=false;fin=false}+ // The visitor takes over: a run stops, and the views' pose no longer needs undoing+ function take(){stopRun();posed=false}+ // A press during a run starts again from where that run began, so the run still ends there; a view's run ends at its pose+ document.getElementById('btn-demo').addEventListener('click',()=>{+ const again=demo;+ stopRun();cancelAnimationFrame(glideRaf);glideRaf=0;demo=true;+ if(!again)runTo=v;+ if(mode!=='normal'&&middle(runTo)){posed=true;runTo=.7}+ glide(.8,700);+ later(()=>glide(.2,900),700,250);+ later(()=>{fin=true;glide(runTo,700,()=>{demo=false;fin=false})},1600,500);+ });+ // Reset puts the line where the box rests: the middle, or the pose in a view+ document.getElementById('btn-reset').addEventListener('click',()=>{+ take();cancelAnimationFrame(glideRaf);glideRaf=0;+ posed=mode!=='normal';aim=runTo=posed?.7:.5;setV(aim);+ });+ document.addEventListener('hb:input',()=>{if(demo)take()});+ stage.addEventListener('focusin',e=>{if(e.isTrusted&&demo)take()});++ // A drag moves the line with the pointer (in Top and bottom, from the handle only, so the page still scrolls); a tap glides it there;+ // a finger that starts up and down on the pictures is a page scroll and leaves the line alone+ const vAt=e=>{const r=front.getBoundingClientRect();return isVert()?1-(e.clientY-r.top)/r.height:(e.clientX-r.left)/r.width};+ ba.addEventListener('pointerdown',e=>{+ if(e.pointerType==='mouse'&&e.button!==0)return;+ drag={id:e.pointerId,x:e.clientX,y:e.clientY,far:false,onHandle:!!e.target.closest('.handle')};+ drag.grab=!isVert()||drag.onHandle;+ if(drag.grab)ba.setPointerCapture(e.pointerId);+ });+ ba.addEventListener('pointermove',e=>{+ if(!drag||e.pointerId!==drag.id)return;+ if(!drag.far){+ const dx=Math.abs(e.clientX-drag.x),dy=Math.abs(e.clientY-drag.y);+ if(Math.hypot(dx,dy)<5)return;+ if(e.pointerType==='touch'&&!drag.onHandle&&drag.grab&&dy>dx){drag=null;return} // an up-and-down swipe: the page scrolls, the line stays+ drag.far=true;+ }+ if(!drag.grab)return;+ take();cancelAnimationFrame(glideRaf);glideRaf=0;setV(vAt(e));aim=v;+ });+ ba.addEventListener('pointerup',e=>{if(!drag||e.pointerId!==drag.id)return;const d=drag;drag=null;if(!d.far){take();glide(vAt(e),300)}});+ ba.addEventListener('pointercancel',()=>{drag=null});+ // The keyboard: the arrows move the line a twentieth, Page Up and Page Down a quarter, Home and End to the ends+ handle.addEventListener('keydown',e=>{+ const step={ArrowRight:.05,ArrowUp:.05,ArrowLeft:-.05,ArrowDown:-.05,PageUp:.25,PageDown:-.25}[e.key];+ const to=e.key==='Home'?0:e.key==='End'?1:step===undefined?null:aim+step;+ if(to===null)return;+ e.preventDefault();take();glide(to,160);+ });++ // See inside's three labels: Before above the back picture, After under the front one, Window over the line. The handle sits on+ // the line, in the middle of the picture; in Top and bottom Window goes beside it when there is room and above the picture when+ // not, and After steps below the handle when the line is near the bottom. Returns each label's place in the box+ function capPlaces(){+ const s=stage.getBoundingClientRect(),b=back.getBoundingClientRect(),f=front.getBoundingClientRect(),vert=isVert(),hb=handle.getBoundingClientRect();+ const size=caps.map(c=>[c.offsetWidth,c.offsetHeight]),lx=f.left-s.left+v*f.width,ly=f.top-s.top+(1-v)*f.height;+ const cx=vert?f.left-s.left+f.width/2:lx,cy=vert?ly:f.top-s.top+f.height/2;+ const H=[cx-hb.width/2-4,cy-hb.height/2-4,cx+hb.width/2+4,cy+hb.height/2+4];+ const hits=(p,i)=>p[0]<H[2]&&p[0]+size[i][0]>H[0]&&p[1]<H[3]&&p[1]+size[i][1]>H[1];+ const at=[[b.left-s.left,b.top-s.top-size[0][1]-6],[f.right-s.left-size[1][0],f.bottom-s.top+6],+ vert?[f.right-s.left-size[2][0]-8,ly-size[2][1]-8]:[lx-size[2][0]/2,f.top-s.top-size[2][1]-6]];+ if(vert){+ if(hits(at[2],2))at[2]=[f.right-s.left-size[2][0],Math.min(f.top-s.top,H[1])-size[2][1]-6];+ if(hits(at[1],1)&&H[3]+size[1][1]<=s.height-8)at[1][1]=H[3]+2;+ }+ return at.map((p,i)=>[Math.max(6,Math.min(s.width-size[i][0]-6,p[0])),Math.max(6,Math.min(s.height-size[i][1]-6,p[1]))]);+ }+ // Compare's first half: a copy of the pictures, made once, with no ids, names or focus, whose After picture is resized+ function makeTwin(){+ twin=ba.cloneNode(true);twin.classList.add('twin');twin.inert=true;twin.setAttribute('aria-hidden','true');+ twin.querySelectorAll('[id],[role],[tabindex],[aria-label]').forEach(n=>['id','role','tabindex','aria-label'].forEach(a=>n.removeAttribute(a)));+ twin.removeAttribute('id');stage.insertBefore(twin,ba);findMovers();+ }+ // The parts that move with the line: the window, the picture in it, and the line with its handle (the copy's too)+ function findMovers(){movers=[...stage.querySelectorAll('.win,.win .pic,.rail')]}+ // The mode switch draws the mode at once. The views hold the line at 70% when it rests in the middle; Normal gets it back.+ document.addEventListener('hb:mode',e=>{+ mode=e.detail.mode;pic.setAttribute('aria-label',LABELS[mode]);+ if(mode==='compare'&&!twin)makeTwin();+ if(mode!=='normal'&&!demo&&!glideRaf&&middle(v)){posed=true;aim=.7;setV(.7)}+ else if(mode==='normal'&&posed){+ // the pose is lifted: at rest at once; in a run, only its end moves (the way back turns toward the middle without a jump)+ posed=false;runTo=.5;+ if(!demo){aim=.5;setV(.5)}else if(fin)glide(.5,300,()=>{demo=false;fin=false});+ }else setV(v);+ });+ new ResizeObserver(()=>setV(v)).observe(stage);++ 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);setV(v);+ }));+ }+ choices('split-seg',d=>{stage.classList.toggle('vert',d.split==='tb');handle.setAttribute('aria-orientation',d.split==='tb'?'vertical':'horizontal')});+ choices('handle-seg',d=>{stage.classList.toggle('h-bar',d.h==='bar');stage.classList.toggle('h-line',d.h==='line')});+ document.getElementById('tags-tog').addEventListener('change',e=>stage.classList.toggle('no-tags',!e.target.checked));+ findMovers();setV(.5);+</script>+</body>+</html>diff --git a/animations/04-micro-interactions/dynamic-island/index.html b/animations/04-micro-interactions/dynamic-island/index.htmlindex f93493fa..14262e3a 100644--- a/animations/04-micro-interactions/dynamic-island/index.html+++ b/animations/04-micro-interactions/dynamic-island/index.html@@ -96,7 +96,7 @@<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="../gooey-menu/" rel="prev" aria-label="Previous: Gooey Menu"><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>Gooey Menu</span></a></span>+ <span class="hb-pager"><a href="../gooey-menu/" rel="prev" aria-label="Previous: Gooey Menu"><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>Gooey Menu</span></a><a href="../before-after-slider/" rel="next" aria-label="Next: Before/After Slider"><span><span class="hb-dir">Next: </span>Before/After Slider</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/index.html b/index.htmlindex 05881cd7..817102f6 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 — 168 Web Animation Techniques with Live Demos</title>-<meta name="description" content="A free visual reference of 168 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 — 169 Web Animation Techniques with Live Demos</title>+<meta name="description" content="A free visual reference of 169 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 — 168 Web Animation Techniques with Live Demos">-<meta property="og:description" content="A free visual reference of 168 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 — 169 Web Animation Techniques with Live Demos">+<meta property="og:description" content="A free visual reference of 169 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 — 168 Web Animation Techniques with Live Demos">-<meta name="twitter:description" content="A free visual reference of 168 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 — 169 Web Animation Techniques with Live Demos">+<meta name="twitter:description" content="A free visual reference of 169 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 168 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 169 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"],@@ -996,6 +996,20 @@ button,input{font:inherit;color:inherit}@keyframes di-is{0%,14%{transform:scale(.32)}26%{transform:scale(1.05)}32%,72%{transform:scale(1)}84%,100%{transform:scale(.32)}}@keyframes di-in{0%,26%{opacity:0}34%,68%{opacity:1}74%,100%{opacity:0}}+.pv-beforeafter{background:#0b0b0d;overflow:hidden;container-type:size}+.pv-beforeafter .sc{position:absolute;inset:0;background:radial-gradient(circle at 72% 44%,#ffe7a8 0 8%,#0000 8.5%),linear-gradient(172deg,#0000 54%,#5b4a8c 54.5% 64%,#0000 64.5%),linear-gradient(#2b3f8f,#f08a6c 50%,#ffd18a 64%,#2a9d9b 64.5%,#0f3b57)}+.pv-beforeafter .gray{filter:grayscale(1) contrast(.72) brightness(1.08)}+.pv-beforeafter .win{position:absolute;inset:0;overflow:hidden;animation:beforeafter-win 5s ease-in-out infinite}+.pv-beforeafter .win .sc{animation:beforeafter-pic 5s ease-in-out infinite}+.pv-beforeafter .ln{position:absolute;inset:0;animation:beforeafter-ln 5s ease-in-out infinite}+.pv-beforeafter .ln::before{content:"";position:absolute;left:-1px;top:0;bottom:0;width:2px;background:#fff}+.pv-beforeafter .ln b{position:absolute;left:-6cqw;top:calc(50% - 6cqw);width:12cqw;height:12cqw;border-radius:50%;background:#fff;box-shadow:0 1px 6px rgba(0,0,0,.4)}+.pv-beforeafter .ln b::before,.pv-beforeafter .ln b::after{content:"";position:absolute;top:calc(50% - 2cqw);left:2cqw;border:2cqw solid #0000;border-right-color:#16161a;border-left-width:0}+.pv-beforeafter .ln b::after{left:auto;right:2cqw;border-width:2cqw 0 2cqw 2cqw;border-color:#0000 #0000 #0000 #16161a}+@keyframes beforeafter-win{0%,8%,100%{transform:translateX(-50%)}30%,42%{transform:translateX(-18%)}66%,78%{transform:translateX(-82%)}}+@keyframes beforeafter-pic{0%,8%,100%{transform:translateX(50%)}30%,42%{transform:translateX(18%)}66%,78%{transform:translateX(82%)}}+@keyframes beforeafter-ln{0%,8%,100%{transform:translateX(50%)}30%,42%{transform:translateX(82%)}66%,78%{transform:translateX(18%)}}+/* ── bespoke: 05 Text & Typography ── */.pv-kinetic{background:#0c0608;display:grid;place-items:center;overflow:hidden}.pv-kinetic .w{font-family:var(--disp);font-weight:800;font-size:38px;color:var(--accent);animation:t-kinetic 3.2s var(--ease) infinite}@@ -1663,7 +1677,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>168 free animations · no coding needed</p>+ <p class="pill"><span class="pill-dot" aria-hidden="true"></span>169 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">@@ -1728,14 +1742,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 168 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 169 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 168 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 169 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">@@ -1753,7 +1767,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">168 web animations with live demos and copyable prompts.</p>+ <p class="foot-t">169 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>@@ -1895,6 +1909,7 @@ const CATS=[['image-trail','Image Trail','Pictures pop up in a trail behind your pointer, then fade. Best for portfolios.'],['gooey-menu','Gooey Menu','Small buttons ooze out of a round button like liquid. Best for quick actions.'],['dynamic-island','Dynamic Island','A black pill grows into a notification, then shrinks back. Best for live updates.'],+ ['before-after-slider','Before/After Slider','Drag a line across two pictures to compare them. Best for photo edits.'],]},{@@ -1998,7 +2013,7 @@ const PV={'rolling-numbers':'rollnum','typing-indicator':'typing','hold-to-confirm':'holdconf','expanding-search':'xsearch','button-loading-states':'btnload',- 'image-trail':'imgtrail','gooey-menu':'gooey','dynamic-island':'dynisland',+ 'image-trail':'imgtrail','gooey-menu':'gooey','dynamic-island':'dynisland','before-after-slider':'beforeafter','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','wave-layers':'wavelayers','snow-rain':'snowrain','fireworks':'fireworks','topographic-lines':'topo','light-rays':'rays','game-of-life':'life',@@ -2144,6 +2159,7 @@ const PLACES={'image-trail':['imgcard','intro'],'gooey-menu':['menu','btn'],'dynamic-island':['load','menu'],+ 'before-after-slider':['imgcard'],// 05'kinetic-typography':['text','intro'],'typewriter-effect':['text','intro'],@@ -2322,6 +2338,7 @@ const FIND={'image-trail':['card','hover','follow grow fade stagger'],'gooey-menu':['button menu','click','morph pieces slide bounce'],'dynamic-island':['loader card shape','click load loop','grow morph bounce fade'],+ 'before-after-slider':['card','drag','reveal slide'],// 05'kinetic-typography':['text','load scroll loop','grow slide fade stagger'],'typewriter-effect':['text','load loop scroll','draw stagger'],@@ -2464,6 +2481,7 @@ function pvMarkup(k){case 'gooey': return '<svg class="gf"><filter id="pvGoo" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="3.5"/><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -9"/></filter></svg>'+'<span class="gw">'+[1,2,3].map(k=>'<i class="t k'+k+' anim"></i>').join('')+[1,2,3].map(k=>'<i class="d k'+k+' anim"></i>').join('')+'<i class="m"></i></span><span class="pl anim"></span>';case 'dynisland': return '<span class="ph"><b>9:41</b></span><span class="is anim"><span class="in anim"><i class="av"></i><i class="l1"></i><i class="l2"></i><i class="no"></i><i class="yes"></i></span></span>';+ case 'beforeafter': return '<span class="sc gray"></span><span class="win anim"><span class="sc anim"></span></span><span class="ln anim"><b></b></span>';case 'gradborder': return '<span class="gbx"><span class="gl"><i class="anim"></i></span><span class="rg"><i class="anim"></i></span><span class="in"><b></b><b></b><b></b></span></span>';case 'spotlight': return '<span class="sg"><span class="lt anim"></span>'+'<i></i>'.repeat(6)+'</span>';case 'cartfly': return '<span class="pd"></span><span class="bt anim"></span><span class="ct anim"><svg viewBox="0 0 24 24"><path d="M2.5 3.5h2.3l2.5 11a1.5 1.5 0 0 0 1.5 1.2h8.6a1.5 1.5 0 0 0 1.4-1.1l1.9-6.6H6"/><circle cx="9.5" cy="19.6" r="1.4"/><circle cx="17" cy="19.6" r="1.4"/></svg><span class="bd"><b class="n2 anim">2</b><b class="n3 anim">3</b></span></span><span class="fx anim"><span class="fy anim"><span class="fs anim"></span></span></span>';diff --git a/llms.txt b/llms.txtindex f47257ac..1587753d 100644--- a/llms.txt+++ b/llms.txt@@ -1,8 +1,8 @@# Animation Handbook-> A visual reference of 168 web animation techniques, each with a live demo and a plain-words prompt for building it with an AI assistant.+> A visual reference of 169 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 168 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 169 prompts and settings at once, install the Agent Skill: `npx skills add matinmonshizadeh/animation-handbook`.## Scroll-Based@@ -115,6 +115,7 @@ Each page plays one technique live and gives a ready-made prompt that describes- [Image Trail](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/image-trail/): Pictures pop up in a trail behind your pointer, then fade. Best for portfolios.- [Gooey Menu](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/gooey-menu/): Small buttons ooze out of a round button like liquid. Best for quick actions.- [Dynamic Island](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/dynamic-island/): A black pill grows into a notification, then shrinks back. Best for live updates.+- [Before/After Slider](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/): Drag a line across two pictures to compare them. Best for photo edits.## Text & Typography@@ -200,11 +201,11 @@ 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 168 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 169 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 41 Micro-Interactions 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 42 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/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 valuesdiff --git a/og-image.png b/og-image.pngindex 2f59c586..b21f417a 100644Binary files a/og-image.png and b/og-image.png differdiff --git a/sitemap.xml b/sitemap.xmlindex 7735beb8..dabf82fc 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-15</lastmod><changefreq>weekly</changefreq><priority>1.0</priority></url>+ <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/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>@@ -101,7 +101,8 @@<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/button-loading-states/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/image-trail/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/gooey-menu/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>- <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/dynamic-island/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/dynamic-island/</loc><lastmod>2026-10-16</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/</loc><lastmod>2026-10-16</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/kinetic-typography/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/typewriter-effect/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/scramble-text/</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 28d43607..de007d62 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 168 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 169 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 168 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 169 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,11 +36,11 @@ 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 168 in one list, grouped by category, with an index by place.+- [references/catalog.md](references/catalog.md): all 169 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, 41 animations. Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns.+- [references/04-micro-interactions.md](references/04-micro-interactions.md): Micro-Interactions, 42 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/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.diff --git a/skills/animation-handbook/references/04-micro-interactions.md b/skills/animation-handbook/references/04-micro-interactions.mdindex 6e7ed8c5..d4e4259d 100644--- a/skills/animation-handbook/references/04-micro-interactions.md+++ b/skills/animation-handbook/references/04-micro-interactions.md@@ -1,6 +1,6 @@# 04 · Micro-Interactions-Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns. 41 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.+Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns. 42 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@@ -45,6 +45,7 @@ Short, user-triggered animations — hover, click, focus, loading states, and UI- [Image Trail](#image-trail)- [Gooey Menu](#gooey-menu)- [Dynamic Island](#dynamic-island)+- [Before/After Slider](#beforeafter-slider)## Hover State Animation@@ -852,3 +853,22 @@ Add a Dynamic Island style notification to [the top of your app or page]. At res- Notification: **Call** · Timer · Music. What the 96 by 32px pill grows into: a call card 76px tall, a timer in a wide capsule 64px tall, or a music card with controls 148px tall; the call and music cards are about 85% as wide as the screen and the timer about 77%; picking another while it is open changes the shape straight into the new one.- Speed: Slow · **Normal** · Fast. How long it takes to grow or shrink: slow is 1100ms, normal 700ms and fast 450ms; a spring needs a little longer than a plain ease, because it settles at the end.- Bounce: None · **Soft** · Springy. None eases out without going past the size; Soft goes past it by about 5% of the change in size and Springy by about 16%, and each settles by the end of its time.++## Before/After Slider++Drag a line across two pictures to compare them. Best for photo edits.++- Live demo: https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/+- How it runs: reacts to the visitor+- Good for: Photo edits · Redesigns · Renovations · Product upgrades+- Avoid on: Small thumbnails · Unrelated pictures++**Prompt**++Add a before-and-after slider to [the two pictures you want to compare]. Stack the pictures exactly on top of each other and show the top one only up to a dividing line with a handle, so each side of the line shows one picture. Dragging on the pictures moves the line, and a tap jumps it there. Uncover the top picture with a clip or a sliding window, never by resizing it, so neither picture moves or squeezes. Use pointer events for mouse and touch, keep page scrolling free on phones, and let the arrow keys move the handle. If the visitor has reduced motion turned on, move the line without gliding. 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):++- Split: **Left and right** · Top and bottom. Which way the line runs: left and right shows After to the left of an upright line, dragged anywhere on the pictures; top and bottom shows After below a level line, dragged by its handle only.+- Handle: **Knob** · Bar · Line only. What there is to grab: knob is a round button with two arrows, bar a narrow bar along the line, line only the bare line (still grabbed across a strip about as wide as a fingertip).+- Shows labels: **on** · off. Before and After name each side from a corner, and each fades out when the line comes within a few pixels of it.diff --git a/skills/animation-handbook/references/catalog.md b/skills/animation-handbook/references/catalog.mdindex 7111846c..cb5654d6 100644--- a/skills/animation-handbook/references/catalog.md+++ b/skills/animation-handbook/references/catalog.md@@ -1,6 +1,6 @@# Catalog-All 168 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 169 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)@@ -80,7 +80,7 @@ Full-page transitions between routes or views — crossfades, slides, portals, m## 04 · Micro-Interactions-Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns. 41 animations, in [04-micro-interactions.md](04-micro-interactions.md).+Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns. 42 animations, in [04-micro-interactions.md](04-micro-interactions.md).- [Hover State Animation](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/hover-state/): Six ways a card can react when you point at it. Best for buttons and cards. Places: Buttons, Images & cards.- [Click / Tap Ripple](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/click-ripple/): A ripple spreads out from the spot you press. Best for buttons and list items. Places: Buttons.@@ -123,6 +123,7 @@ Short, user-triggered animations — hover, click, focus, loading states, and UI- [Image Trail](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/image-trail/): Pictures pop up in a trail behind your pointer, then fade. Best for portfolios. Places: Images & cards, Page intros.- [Gooey Menu](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/gooey-menu/): Small buttons ooze out of a round button like liquid. Best for quick actions. Places: Menus & forms, Buttons.- [Dynamic Island](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/dynamic-island/): A black pill grows into a notification, then shrinks back. Best for live updates. Places: Loading & messages, Menus & forms.+- [Before/After Slider](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/before-after-slider/): Drag a line across two pictures to compare them. Best for photo edits. Places: Images & cards.## 05 · Text & Typography@@ -213,7 +214,7 @@ 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** (46): 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, 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+- **Images & cards** (47): 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, 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- **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 Glowdiff --git a/tests/pages.test.js b/tests/pages.test.jsindex f25e5eda..7cd7eed1 100644--- a/tests/pages.test.js+++ b/tests/pages.test.js@@ -412,7 +412,7 @@ test("on phones the mode switch's own rule outranks the rule for choice buttons,// the page answers keys (its own script listens for keydown, or its own style has a :focus-visible rule). Every page that// misses one is listed at once.const KEYBOARD_PAGES = {- '04-micro-interactions': ['cursor-follower', 'hover-state', 'image-trail', 'spotlight-hover', 'magnetic-button', 'click-ripple'],+ '04-micro-interactions': ['cursor-follower', 'hover-state', 'image-trail', 'spotlight-hover', 'magnetic-button', 'click-ripple', 'before-after-slider'],'05-text-typography': ['text-particles'],'06-3d-advanced': ['2-5d-pseudo-3d', 'depth-map-photo', 'holographic-card', 'image-distortion-hover', 'parallax-3d-tilt']};