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: Card Deck Swipe (04.44), a new Micro-Interactions page
matin2d2bc741105d
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.ymlindex 08c814e2..103476ac 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 170 techniques running before filing an issue.+ about: See all 171 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 c6cd88ad..ed9d3a77 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 170 animations</a>+ <a class="way" href="/animation-handbook/?view=all#results">Browse all 171 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 3e27458c..86cc1f90 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -23,6 +23,8 @@ The main steps of Animation Handbook, newest first, with the number of animationCompare from the start.- A new animation, Magnifier Lens (170 in all): a lens follows your pointer and shows the picture up close, with See insideand 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 inside+ and Compare from the start.## 1.0.0 — 2026-10-10diff --git a/README.md b/README.mdindex 5fbae596..a8d1dfde 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 170 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 171 web animation techniques" width="820"></picture></a># Animation Handbook-**A visual reference of 170 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 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.**[**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 170 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 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.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) | 43 |+| 04 | [Micro-Interactions](#04) | 44 || 05 | [Text & Typography](#05) | 19 || 06 | [3D & Advanced](#06) | 26 || 07 | [Ambient & Background](#07) | 23 |## Full catalog-All 170 techniques, each linked to its live demo.+All 171 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 · 43 techniques+### 04 · Micro-Interactions · 44 techniques<sub>Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns.</sub>-<details><summary>Browse all 43 techniques in Micro-Interactions</summary>+<details><summary>Browse all 44 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.@@ -216,6 +216,7 @@ Each technique's code and README are in its folder under [animations/](animation- **[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.- **[Magnifier Lens](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/)** — A lens follows your pointer and shows the picture up close. Best for product photos.+- **[Card Deck Swipe](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/)** — Swipe the top card left or right; the next one rises. Best for quick choices.</details>diff --git a/animations/04-micro-interactions/README.md b/animations/04-micro-interactions/README.mdindex 7d2f6e26..beec1a54 100644--- a/animations/04-micro-interactions/README.md+++ b/animations/04-micro-interactions/README.md@@ -49,6 +49,7 @@ Short, user-triggered animations that provide feedback, confirm actions, and com| [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. || [Magnifier Lens](magnifier-lens/) | A lens follows your pointer and shows the picture up close. Best for product photos. |+| [Card Deck Swipe](card-deck-swipe/) | Swipe the top card left or right; the next one rises. Best for quick choices. |## Key conceptsdiff --git a/animations/04-micro-interactions/card-deck-swipe/README.md b/animations/04-micro-interactions/card-deck-swipe/README.mdnew file mode 100644index 00000000..53566713--- /dev/null+++ b/animations/04-micro-interactions/card-deck-swipe/README.md@@ -0,0 +1,49 @@+# Card Deck Swipe++[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/)++## What it is+A card deck swipe shows a pile of cards, such as profiles or products, one at a time. The top card follows a drag, turns a little as if held at its bottom edge, and flies off to the left or the right when let go far enough, while the next card grows into its place. The two sides are two answers, such as no and yes, so people decide quickly, one card at a time.++## When to use it+- Matching and dating apps+- Product pickers and "this or that" shopping+- Flashcards: known, or not yet+- Quick polls and preference quizzes++## How it works+The cards are stacked in one box. Each card knows its depth (0 on top), and the waiting cards are moved down and made a little smaller from that number, so the pile peeks out behind the top card:++```css+.card { transform-origin: 50% 130%; /* a point below the bottom edge */+ transform: translateY(calc(var(--i) * 12px)) scale(calc(1 - var(--i) * .05)); }+```++While it is dragged, the top card's transform follows the pointer and turns in proportion to the distance. Because it turns around a point below its bottom edge, its top swings further than its bottom, as a card held at the bottom would. The stamps grow stronger with the distance:++```js+card.style.transform = `translate(${dx}px, ${dy}px) rotate(${dx / cardWidth * turn}deg)`;+like.style.opacity = Math.min(1, Math.max(0, dx / (threshold * cardWidth)));+```++On release, a card whose middle went past the swipe distance, or that was flicked away from the middle faster than half a pixel per millisecond, gets a transition and is moved off that side; otherwise it springs back with an overshooting curve. The next card's depth becomes 0, so its own transition grows it into place, and the card that left is removed once its transition ends. Undo puts the last card back on top where it left and lets the transition bring it in. Nope, Like and Undo are real buttons, the Left and Right keys work on the focused top card, and each choice is also written into a polite status line for screen readers. Under reduced motion, cards fade instead of flying.++## Key parameters+| Parameter | Default | Effect |+|-----------|---------|--------|+| How far to swipe | Medium | How far the card's middle must go before letting go sends it: short is a quarter of the card's width, medium 40% and long 60%; a quick flick sends it from anywhere |+| How much it turns | A little | How far the card turns for each card width of drag, around a point below its bottom edge: none does not turn, a little turns 14 degrees and a lot 30 degrees |+| Shows stamps | on | Like in green and Nope in red fade in on the card as it is dragged, fully shown at the swipe distance |+| Cards behind | Peeking | How the waiting cards show: peeking sets each one a little lower and 5% smaller, fanned turns them 5 degrees left or right in turn around the same low point, hidden shows only the top card until the next one grows in |++## Production notes+- **Transforms only.** Move, turn and grow the cards with transform and fade them with opacity; never change their left, top or size.+- **Pointer events.** One set of pointerdown, pointermove and pointerup handlers, with pointer capture, serves mouse, pen and touch; `touch-action: pan-y` keeps vertical scrolling on phones. A finger that starts moving up and down is a scroll, so let go of the card at once, and a `pointercancel` springs it back.+- **Keep a few cards in the page.** Render the top three to five cards, add more as cards leave, and remove a card once its fly-off ends.+- **Buttons and keys.** Swiping alone shuts out keyboards and some assistive tools: add Nope, Like and Undo buttons and arrow keys, and announce each choice in a polite live region.+- **Libraries.** react-tinder-card and Swiper's cards effect package the idea; in an app, Framer Motion's `drag` with a velocity check in `onDragEnd`, or GSAP's Draggable, builds it.+- **Reduced motion.** Fade the card out instead of throwing it, and let the next one appear without growing.++## See also+- [Swipe to Dismiss](../swipe-to-dismiss/) — one list row slides off with a drag or a flick+- [3D Carousel](../../06-3d-advanced/carousel-3d/) — cards on a ring that turn with a drag and glide ondiff --git a/animations/04-micro-interactions/card-deck-swipe/index.html b/animations/04-micro-interactions/card-deck-swipe/index.htmlnew file mode 100644index 00000000..ed7ea437--- /dev/null+++ b/animations/04-micro-interactions/card-deck-swipe/index.html@@ -0,0 +1,435 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Card Deck Swipe — Animation Handbook</title>+ <meta name="description" content="Swipe the top card left or right; the next one rises. Best for quick choices.">+ <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/">+ <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="Card Deck Swipe — Animation Handbook">+ <meta property="og:description" content="Swipe the top card left or right; the next one rises. Best for quick choices.">+ <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/">+ <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="Card Deck Swipe — Animation Handbook">+ <meta name="twitter:description" content="Swipe the top card left or right; the next one rises. Best for quick choices.">+ <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": "Card Deck Swipe", "name": "Card Deck Swipe", "description": "Swipe the top card left or right; the next one rises. Best for quick choices.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/", "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, Card Deck Swipe"}</script>+ <style>+ :root{--ui-accent:#ff9d5c;--like:#34c77b;--nope:#ff5a5f;--undo:#f5c84c}+ *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}+ /* --sp: 3 in slow motion. The box is taller on phones, in every mode alike, so the pile and its buttons both fit */+ .stage{--sp:1;--hb-stage-h-phone:400px;position:relative;display:flex;flex-direction:column;background:#0b0b0d;-webkit-user-select:none;user-select:none}+ .decks{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}+ .deck{position:relative;min-width:0;container-type:size}+ .pile{position:absolute;inset:0}+ /* A card: about 60% of the box's width at most, turning around a point below its bottom edge (transform-origin) */+ .card{--tb:translateY(calc(var(--i) * 12px)) scale(calc(1 - var(--i) * .05));position:absolute;left:50%;top:50%;width:min(70cqh,60cqw);aspect-ratio:4/5;translate:-50% -50%;+ display:flex;flex-direction:column;overflow:hidden;border-radius:14px;background:#17171c;box-shadow:0 10px 26px rgba(0,0,0,.45);container-type:inline-size;+ transform-origin:50% 130%;transform:var(--spread,translate(0)) var(--tb);touch-action:pan-y;cursor:grab;+ transition:transform calc(.3s * var(--sp)) cubic-bezier(.2,.8,.2,1),opacity calc(.3s * var(--sp))}+ .fan .card{--tb:rotate(calc(var(--i) * var(--f) * 5deg)) scale(calc(1 - var(--i) * .03))}+ .hide .card{--tb:scale(calc(1 - min(var(--i),1) * .05))}+ .hide .card:not(.top),.card.deep{opacity:0}+ .card.drag{transition:none}+ .card.spring{transition:transform calc(.4s * var(--sp)) cubic-bezier(.3,1.35,.5,1),opacity calc(.3s * var(--sp))}+ .card.out{pointer-events:none;transition:transform calc(.42s * var(--sp)) cubic-bezier(.4,0,1,1),opacity calc(.42s * var(--sp)) ease-in}+ .photo{flex:1;min-height:0;background:radial-gradient(circle at 50% 44%,#f1c7a3 0 15%,#0000 15.5%),radial-gradient(circle at 50% 37%,var(--hair) 0 19%,#0000 19.5%),radial-gradient(ellipse 34% 24% at 50% 100%,var(--shirt) 0 99%,#0000 100%),linear-gradient(160deg,var(--bg1),var(--bg2))}+ .who{padding:8cqw 9cqw 1cqw;color:#f4f4f2;font:700 clamp(12px,8.5cqw,19px)/1.2 var(--hb-font)}+ .line{padding:0 9cqw;color:#b4b4bb;font:500 clamp(10px,6cqw,13px)/1.4 var(--hb-font);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}+ .line:last-of-type{padding-bottom:7cqw}+ .stamp{position:absolute;top:8%;padding:1px 8px;border:3px solid;border-radius:8px;font:800 clamp(13px,11cqw,24px)/1.15 var(--hb-font);letter-spacing:.06em;opacity:0;pointer-events:none}+ .like{left:8%;color:var(--like);transform:rotate(-14deg)}.nope{right:8%;color:var(--nope);transform:rotate(14deg)}+ .spring .stamp{transition:opacity calc(.3s * var(--sp))}+ /* Nope, Undo and Like: round buttons under the pile, 48px to touch */+ .acts{display:flex;justify-content:center;gap:18px;padding:8px 0 12px}+ .act{display:grid;place-items:center;width:48px;height:48px;border-radius:50%;border:1px solid rgba(255,255,255,.14);background:#17171c;cursor:pointer}+ .act svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}+ .nope-b{color:var(--nope)}.undo-b{color:var(--undo)}.like-b{color:var(--like)}+ @media(hover:hover){.act:hover{border-color:currentColor}}+ /* See inside and Compare: plain words over the stage; in See inside the pile spread apart and numbered, the swipe distance+ dashed on both sides (lit once the card's middle passes it) and the point the card turns around */+ .guide,.pivot,.twin,.cap{display:none}+ .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}+ .cap{position:absolute;left:0;top:0;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"] .deck{transform:scale(.7);transform-origin:50% 8%}+ .stage[data-hb-mode="inside"] .card{--spread:translate(calc(var(--i) * -40px),calc(var(--i) * -14px))}+ .stage[data-hb-mode="inside"].hide .card:not(.top):not(.deep){opacity:.45}+ .stage[data-hb-mode="inside"] .card::after{content:attr(data-n);position:absolute;left:8px;bottom:8px;width:32px;height:32px;border-radius:50%;background:var(--ui-accent);color:#16161a;font:800 18px/32px var(--hb-font);text-align:center}+ .stage[data-hb-mode="inside"] .guide,.stage[data-hb-mode="inside"] .pivot{display:block}+ .guide{position:absolute;left:50%;top:0;z-index:2;border-left:3px dashed rgba(255,255,255,.6);pointer-events:none}+ .guide.lit{border-left-color:var(--ui-accent)}+ .pivot{position:absolute;left:0;top:0;z-index:2;width:60px;height:60px;margin:-30px 0 0 -30px;overflow:visible;pointer-events:none}+ .pivot path{fill:none;stroke:var(--ui-accent);stroke-width:3;stroke-linecap:round}.pivot circle{fill:var(--ui-accent);stroke:#0b0b0d;stroke-width:2}+ /* Compare: a copy of the pile whose cards slide flat and vanish beside the real one; one drag moves both; a card flying off+ is cut off at its own half's edge (lesson 14) */+ .stage[data-hb-mode="compare"] .decks{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:4px}.stage[data-hb-mode="compare"] .deck{overflow:hidden}+ .stage[data-hb-mode="compare"] .twin{display:block}+ .twin .card,.twin .card.spring{transition:none}+ .cap.half{top:8px}.cap.first{left:8px}.cap.second{left:calc(50% + 10px)}+ @media(prefers-reduced-motion:reduce){.card,.card.spring,.card.out{transition:opacity .2s}.spring .stamp{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="../magnifier-lens/" rel="prev" aria-label="Previous: Magnifier Lens"><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>Magnifier Lens</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.44 · Micro-Interactions</p>+ <h1>Card Deck Swipe</h1>+ <p class="hb-lede">Swipe the top card left or right; the next one rises. Best for quick choices.</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 top card sideways and let go (or Tab to it and use 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">+ <div class="decks">+ <div class="deck" id="deck">+ <div class="pile" id="pile" role="group" aria-label="Profile cards"></div>+ <span class="guide gl" aria-hidden="true"></span><span class="guide gr" aria-hidden="true"></span>+ <svg class="pivot" viewBox="-30 -30 60 60" aria-hidden="true"><path d="M-17-13A21 21 0 0 1 17-13M11-19 17-13 10-8M-11-19-17-13-10-8"/><circle r="6"/></svg>+ </div>+ </div>+ <div class="acts">+ <button class="act nope-b" type="button" id="btn-nope" aria-label="Nope"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18"/></svg></button>+ <button class="act undo-b" type="button" id="btn-undo" aria-label="Undo"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 0 11H11"/></svg></button>+ <button class="act like-b" type="button" id="btn-like" aria-label="Like"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10Z"/></svg></button>+ </div>+ <p class="sr-only" id="say" role="status" aria-live="polite"></p>+ <p class="cap in" id="c-go" aria-hidden="true" data-hb-caption>Let go past here: it flies</p>+ <p class="cap in" id="c-held" aria-hidden="true" data-hb-caption>Held here, so it turns</p>+ <p class="cap in" id="c-next" aria-hidden="true" data-hb-caption>Next · waits a little smaller</p>+ <p class="cap half first" aria-hidden="true" data-hb-caption>Vanishes</p>+ <p class="cap half second" aria-hidden="true" data-hb-caption>Flies off</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, the pile is spread apart and numbered: each waiting card is smaller. The top card turns around a point below it, and a dashed line lights once it is far enough to fly.</p>+ <p data-hb-for="compare" hidden>On the left the card vanishes when you let go, so it is hard to tell where it went. On the right it flies off the side you chose as the next one rises.</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 a card or press Show me.</p></div>+ </div>+ <div class="hb-settings">+ <div class="hb-setting">+ <p class="hb-setting-name" id="dist-lbl">How far to swipe</p>+ <div class="seg" id="dist-seg" role="group" aria-labelledby="dist-lbl">+ <button type="button" data-t="0.25" aria-pressed="false">Short</button>+ <button type="button" data-t="0.4" class="on" aria-pressed="true">Medium</button>+ <button type="button" data-t="0.6" aria-pressed="false">Long</button>+ </div>+ <p class="hb-hint">How far to drag before letting go sends it.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="turn-lbl">How much it turns</p>+ <div class="seg" id="turn-seg" role="group" aria-labelledby="turn-lbl">+ <button type="button" data-turn="0" aria-pressed="false">None</button>+ <button type="button" data-turn="14" class="on" aria-pressed="true">A little</button>+ <button type="button" data-turn="30" aria-pressed="false">A lot</button>+ </div>+ <p class="hb-hint">As if held at the bottom edge.</p>+ </div>+ <div class="hb-setting">+ <label class="hb-switch-row"><span>Shows stamps</span><input class="hb-switch" type="checkbox" role="switch" id="stamp-tog" checked autocomplete="off"></label>+ <p class="hb-hint">Like and Nope fade in as you drag.</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">+ <p class="hb-setting-name" id="behind-lbl">Cards behind</p>+ <div class="seg" id="behind-seg" role="group" aria-labelledby="behind-lbl">+ <button type="button" data-behind="peek" class="on" aria-pressed="true">Peeking</button>+ <button type="button" data-behind="fan" aria-pressed="false">Fanned</button>+ <button type="button" data-behind="hide" aria-pressed="false">Hidden</button>+ </div>+ <p class="hb-hint">How the waiting cards show.</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 swipeable card deck to [your stack of cards, such as profiles or products]. Pile the cards with the waiting ones behind the top one, showing as the settings choose. While dragged, the top card follows the finger and turns as the settings choose, as if held at its bottom edge, and Like or Nope stamps fade in when the settings include them. On release, send it off that side if it went far enough or was flicked; otherwise spring it back, and grow the next card into place. Use transforms and pointer events, let up-and-down scrolling pass through, and add Nope, Like and Undo buttons for keyboards. If the visitor has reduced motion turned on, fade cards out instead of throwing them. 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>Matching apps</li><li>Product pickers</li><li>Flashcards</li><li>Quick polls</li></ul>+ <h3>Avoid on</h3>+ <ul class="hb-tags hb-avoid"><li>Lists people compare</li><li>Choices that need care</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'),deck=document.getElementById('deck'),slowTog=document.getElementById('slow-tog');+ const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),gl=deck.querySelector('.gl'),gr=deck.querySelector('.gr'),pivot=deck.querySelector('.pivot');+ const caps=['c-go','c-held','c-next'].map(id=>document.getElementById(id)),sayEl=document.getElementById('say');+ const pileEl=document.getElementById('pile'),LABELS={normal:pileEl.getAttribute('aria-label'),+ inside:'Profile cards spread apart and numbered, with dashed lines at the swipe distance and the point the top card turns around',+ compare:'Profile cards: this pile flies off when let go, and a copy beside it vanishes'};+ // Five made-up people: name, two lines, and the picture's colors (background, shirt, hair)+ const PEOPLE=[['Mira, 27','Climbs on weekends','Bakes bread at dawn','#ff9a76','#7c4dff','#2f3b8f','#3b2416'],+ ['Theo, 31','Plays the cello','Has two old cats','#5ec7c0','#1f5f8b','#e8b04a','#1b1b1f'],+ ['Lena, 25','Draws maps for fun','Runs by the river','#f6c85f','#d1495b','#3a7d44','#8a4b2a'],+ ['Kofi, 29','Cooks for twelve','Fixes old bikes','#8fb8ff','#3d348b','#f26b38','#16120f'],+ ['Ines, 33','Grows tomatoes','Loves night trains','#b8e1a3','#2d6a4f','#9b5de5','#5a2d1c']];+ const real={pile:document.getElementById('pile'),twin:false};+ // thr: how far the card's middle must go to fly, as a share of its width; turn: degrees of turn for a card width of drag+ let thr=.4,turn=14,stamps=true,mode='normal',twin=null,cardW=0,cardH=0,dx=0,gone=[],drag=null,runTimers=[],runFrame=0,runDragging=false,thrown=false;+ const decks=()=>twin?[real,twin]:[real];+ const live=d=>[...d.pile.children].filter(c=>!c.classList.contains('out'));+ const topOf=d=>{const l=live(d);return l[l.length-1]||null};+ const clamp01=x=>Math.min(1,Math.max(0,x));++ function cardEl(p,copy){+ const [who,l1,l2,bg1,bg2,shirt,hair]=PEOPLE[p],c=document.createElement('div');+ c.className='card';c.dataset.p=p;c.style.setProperty('--f',p%2?1:-1);+ c.innerHTML=`<div class="photo" style="--bg1:${bg1};--bg2:${bg2};--shirt:${shirt};--hair:${hair}"></div><p class="who">${who}</p><p class="line">${l1}</p><p class="line">${l2}</p>`++ (copy?'':'<span class="stamp like" aria-hidden="true">LIKE</span><span class="stamp nope" aria-hidden="true">NOPE</span>');+ return c;+ }+ // Depth of every card (0 on top); only the top card of the real pile takes focus, and it says what the keys do+ function restack(d){+ const l=live(d);+ l.forEach((c,k)=>{+ const i=l.length-1-k;c.style.setProperty('--i',i);c.dataset.n=i+1;c.classList.toggle('top',!i);c.classList.toggle('deep',i>=(mode==='inside'?4:3));+ if(i)c.style.transform='';+ if(d.twin)return;+ if(i)c.querySelectorAll('.stamp').forEach(m=>{m.style.opacity=''});+ c.tabIndex=i?-1:0;+ if(i){c.removeAttribute('aria-label');c.removeAttribute('role')}+ else{c.setAttribute('role','group');c.setAttribute('aria-label',PEOPLE[c.dataset.p].slice(0,3).join(', ')+'. Left arrow for Nope, right arrow for Like')}+ });+ }+ function build(){gone=[];dx=0;for(const d of decks()){d.pile.textContent='';[4,3,2,1,0].forEach(p=>d.pile.appendChild(cardEl(p,d.twin)));restack(d)}}+ // The top card where a drag puts it: moved, turned around its pivot below, its stamp as strong as the drag is far; the copy in+ // Compare only slides, flat. See inside lights the line the card's middle has passed and moves the pivot with the card.+ function follow(x,y=0){+ dx=x;const c=topOf(real),s=thr*cardW,t=twin&&topOf(twin);+ if(c){+ c.style.transform=x||y?`translate(${x}px,${y}px) rotate(${cardW?x/cardW*turn:0}deg)`:'';+ c.querySelector('.like').style.opacity=stamps?clamp01(x/s):0;c.querySelector('.nope').style.opacity=stamps?clamp01(-x/s):0;+ }+ if(t)t.style.transform=x?`translateX(${x}px)`:'';+ gr.classList.toggle('lit',x>s);gl.classList.toggle('lit',-x>s);+ pivot.style.transform=`translate(${deck.clientWidth/2+x}px,${deck.clientHeight/2+cardH*.8+y}px)`;+ if(mode==='inside')placeCaps();+ }+ // At rest the top card sits in the middle; See inside holds it half way to the line, Compare a third of a card to the right+ // (short of the line, so a plain click never sends it)+ const restX=()=>mode==='inside'?thr*cardW/2:mode==='compare'?Math.min(cardW/3,thr*cardW*.8):0;+ function settle(spring){+ for(const d of decks()){const c=topOf(d);if(c){c.classList.remove('drag');c.classList.toggle('spring',spring)}}+ follow(restX());+ }+ // The top card leaves to one side (under reduced motion it fades where it is); the copy's card vanishes at once; the next card+ // grows into place, and an empty pile fills again+ function send(dir,quiet){+ const c=topOf(real);if(!c)return;+ if(!quiet)sayEl.textContent=(dir>0?'Like: ':'Nope: ')+PEOPLE[c.dataset.p][0];+ const had=document.activeElement===c,t=twin&&topOf(twin);+ gone.push({p:+c.dataset.p,dir});if(t)t.remove();+ c.classList.remove('drag','spring','top');c.classList.add('out');c.style.opacity='0';+ if(!reduceMQ.matches)c.style.transform=`translate(${dir*cardW*2.2}px,${-cardW*.12}px) rotate(${dir*Math.max(turn,8)*1.6}deg)`;+ c.addEventListener('transitionend',()=>{c.remove();if(!live(real).length&&!real.pile.children.length){build();settle(false)}},{once:true});+ for(const d of decks())restack(d);+ settle(!reduceMQ.matches);+ // a throw Show me plays leaves focus alone: moving it would count as the visitor's own focus and stop the run before its Undo+ const n=topOf(real);if(had&&!quiet)(n||document.getElementById('btn-undo')).focus({preventScroll:true});+ }+ // Undo: the last card comes back from the side it left on (under reduced motion it fades in)+ function undo(quiet){+ const g=gone.pop();if(!g)return;+ if(!quiet)sayEl.textContent='Undone: '+PEOPLE[g.p][0]+' is back on top';+ const c=cardEl(g.p,false);c.classList.add('drag');c.style.opacity='0';+ if(!reduceMQ.matches)c.style.transform=`translate(${g.dir*cardW*2.2}px,${-cardW*.12}px) rotate(${g.dir*Math.max(turn,8)*1.6}deg)`;+ real.pile.appendChild(c);if(twin)twin.pile.appendChild(cardEl(g.p,true));+ for(const d of decks())restack(d);+ void c.offsetWidth;c.style.opacity='';settle(!reduceMQ.matches);+ }++ // The visitor's drag: the top card follows the pointer (touch-action pan-y keeps the page scrolling up and down); letting go+ // past the line or with a flick sends it, otherwise it springs back+ const scale=()=>deck.getBoundingClientRect().width/deck.offsetWidth||1;+ real.pile.addEventListener('pointerdown',e=>{+ const c=e.target.closest('.card');if(!c||c!==topOf(real)||(e.pointerType==='mouse'&&e.button!==0))return;+ stopRun();const k=scale();+ drag={id:e.pointerId,x0:e.clientX-dx*k,y0:e.clientY,sx:e.clientX,touch:e.pointerType==='touch',axis:'',k,lastX:e.clientX,lastT:performance.now(),vel:0};+ for(const d of decks()){const t=topOf(d);if(t){t.classList.add('drag');t.classList.remove('spring')}}+ c.setPointerCapture(e.pointerId);+ });+ real.pile.addEventListener('pointermove',e=>{+ if(!drag||e.pointerId!==drag.id)return;+ // a finger that starts moving up and down is a page scroll: let go of the card (touch-action pan-y hands the gesture over)+ if(drag.touch&&!drag.axis){+ const mx=Math.abs(e.clientX-drag.sx),my=Math.abs(e.clientY-drag.y0);+ if(mx<8&&my<8)return;+ if(my>mx){drag=null;settle(!reduceMQ.matches);return}+ drag.axis='x';+ }+ const now=performance.now();if(now>drag.lastT){drag.vel=(e.clientX-drag.lastX)/(now-drag.lastT);drag.lastX=e.clientX;drag.lastT=now}+ follow((e.clientX-drag.x0)/drag.k,(e.clientY-drag.y0)/drag.k*.25);+ });+ function release(e,cancelled){+ if(!drag||e.pointerId!==drag.id)return;+ const d=drag;drag=null;if(performance.now()-d.lastT>100)d.vel=0;+ const past=Math.abs(dx)>thr*cardW,flick=Math.abs(d.vel)>.5&&Math.abs(dx)>20&&Math.sign(d.vel)===Math.sign(dx);+ if(!cancelled&&(past||flick))send(dx>0?1:-1);else settle(!reduceMQ.matches);+ }+ real.pile.addEventListener('pointerup',e=>release(e,false));+ real.pile.addEventListener('pointercancel',e=>release(e,true));+ // The keyboard and the buttons: Left and Right on the focused top card, or Nope, Like and Undo+ real.pile.addEventListener('keydown',e=>{+ if(e.target!==topOf(real)||(e.key!=='ArrowLeft'&&e.key!=='ArrowRight'))return;+ e.preventDefault();stopRun();send(e.key==='ArrowRight'?1:-1);+ });+ document.getElementById('btn-nope').addEventListener('click',()=>{stopRun();send(-1)});+ document.getElementById('btn-like').addEventListener('click',()=>{stopRun();send(1)});+ document.getElementById('btn-undo').addEventListener('click',()=>{stopRun();undo()});++ // Show me: a drag that springs back, a throw to the left, then Undo. Its drags move the card the way a finger would, by the+ // time that passes; every pause waits on a timer, and slow motion triples the moves, never the pauses.+ function later(fn,move,hold){const id=setTimeout(()=>{runTimers=runTimers.filter(t=>t!==id);fn()},move*(slowTog.checked?3:1)+hold);runTimers.push(id)}+ const running=()=>runTimers.length>0||runFrame!==0;+ function runDrag(to,ms,then){+ for(const d of decks()){const t=topOf(d);if(t){t.classList.add('drag');t.classList.remove('spring')}}+ const from=dx,dur=ms*(slowTog.checked?3:1);let t0=null;runDragging=true;+ const step=ts=>{+ if(t0===null)t0=ts;+ const k=reduceMQ.matches?1:Math.min(1,(ts-t0)/dur);follow(from+(to-from)*k*k*(3-2*k));+ if(k<1){runFrame=requestAnimationFrame(step);return}+ runFrame=0;runDragging=false;then();+ };+ runFrame=requestAnimationFrame(step);+ }+ function stopRun(){+ thrown=false;runTimers.forEach(clearTimeout);runTimers=[];cancelAnimationFrame(runFrame);runFrame=0;+ if(runDragging){runDragging=false;settle(!reduceMQ.matches)}+ }+ document.getElementById('btn-demo').addEventListener('click',()=>{+ const back=thrown;stopRun();+ if(back)undo(true); // the last run was cut short between its throw and its Undo: the card comes back first, so every run starts from the same pile+ if(!topOf(real))return;+ const s=thr*cardW;+ runDrag(restX()+s*.55,700,()=>settle(!reduceMQ.matches));+ // the spring-back (400 ms) and the fly-off (420 ms) count as moves, so slow motion slows them as it slows the drags+ later(()=>runDrag(-(s+cardW*.2),600,()=>{thrown=true;send(-1,true)}),700+400,200);+ later(()=>{thrown=false;undo(true)},1300+400+420,580);+ });+ document.getElementById('btn-reset').addEventListener('click',()=>{stopRun();build();settle(false)});+ document.addEventListener('hb:input',()=>{if(running())stopRun()});+ stage.addEventListener('focusin',e=>{if(e.isTrusted&&running())stopRun()});++ // See inside's labels, measured before any moves. Each has a few places to try, the usual one first: the line's under its end+ // (or below the pivot's arc, or above the line), the pivot's to its left (or right, or one or two rows below), the next card's+ // above it (or above both cards, or in the box's corner, or below the pile). Of every combination the one that costs least wins:+ // overlap with the pivot's arc and with each other, a little for covering the top card, and a fixed price for a far place.+ function placeCaps(){+ const s=stage.getBoundingClientRect(),R=el=>{const b=el.getBoundingClientRect();return[b.left-s.left,b.top-s.top,b.right-s.left,b.bottom-s.top]};+ const n=live(real),nx=n[n.length-2],g=R(gr),p=R(pivot),b=nx?R(nx):[6,6,6,6],t=R(topOf(real)||pivot),u=(p[2]-p[0])/60,cx=(p[0]+p[2])/2,cy=(p[1]+p[3])/2;+ const arc=[cx-20*u-3,cy-24*u-3,cx+20*u+3,cy+9*u+3],gx=(g[0]+g[2])/2;+ const area=(a,c)=>Math.max(0,Math.min(a[2],c[2])-Math.max(a[0],c[0]))*Math.max(0,Math.min(a[3],c[3])-Math.max(a[1],c[1]));+ const spots=[(w,h)=>[[gx-w/2,g[3]+4,0],[gx-w/2,arc[3]+4,5],[gx-w/2,g[1]-h-4,10]],+ (w,h)=>[[arc[0]-4-w,cy-h/2,0],[arc[2]+4,cy-h/2,5],[cx-w/2,arc[3]+4,10],[cx-w/2,arc[3]+8+h,15]],+ (w,h)=>[[b[0],b[1]-h-6,0],[b[0],Math.min(b[1],t[1])-h-6,0],[b[0],Math.max(b[3],t[3])+6,800],[s.width-w-6,6,1500],[6,6,1500]]];+ const opts=caps.map((el,i)=>{const w=el.offsetWidth,h=el.offsetHeight;return spots[i](w,h).map(([x,y,pen])=>{x=Math.max(6,Math.min(s.width-w-6,x));y=Math.max(6,Math.min(s.height-h-6,y));return[x,y,x+w,y+h,pen]})});+ let best=null;+ for(const r0 of opts[0])for(const r1 of opts[1])for(const r2 of opts[2]){+ const cost=area(r0,arc)+area(r1,arc)+area(r2,arc)+area(r0,r1)+area(r0,r2)+area(r1,r2)+area(r2,t)/4+r0[4]+r1[4]+r2[4];+ if(!best||cost<best.cost)best={cost,r:[r0,r1,r2]};+ }+ best.r.forEach((r,i)=>{caps[i].style.transform=`translate(${r[0]}px,${r[1]}px)`});+ }+ // the cards move with transitions, so the next card's box is only final once they end+ real.pile.addEventListener('transitionend',e=>{if(mode==='inside'&&e.propertyName==='transform')placeCaps()});+ // Compare's first half: a copy of the pile, made once, inert and unnamed; it then follows every change of the real one+ function makeTwin(){+ const el=document.createElement('div');el.className='deck twin';el.inert=true;el.setAttribute('aria-hidden','true');+ el.innerHTML='<div class="pile"></div>';deck.before(el);twin={pile:el.firstChild,twin:true};+ live(real).forEach(c=>twin.pile.appendChild(cardEl(+c.dataset.p,true)));restack(twin);+ }+ // Card sizes, and the dashed lines at the swipe distance: from a little above the card down to its bottom edge+ function measure(){+ const c=real.pile.querySelector('.card');cardW=c?c.offsetWidth:0;cardH=c?c.offsetHeight:0;+ for(const [g,k] of [[gl,-1],[gr,1]]){g.style.top=deck.clientHeight/2-cardH*.56+'px';g.style.height=cardH*1.08+'px';g.style.transform=`translateX(${k*thr*cardW}px)`}+ }+ // The mode switch draws the mode at once: the card at the mode's rest, with no spring+ document.addEventListener('hb:mode',e=>{+ mode=e.detail.mode;pileEl.setAttribute('aria-label',LABELS[mode]);+ if(mode==='compare'&&!twin)makeTwin();+ for(const d of decks())restack(d);+ measure();if(!drag&&!running())settle(false);else follow(dx);+ });+ new ResizeObserver(()=>{measure();follow(drag||running()?dx:restX())}).observe(deck);++ 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);measure();if(!drag&&!running())settle(false);+ }));+ }+ choices('dist-seg',d=>{thr=+d.t});+ choices('turn-seg',d=>{turn=+d.turn});+ choices('behind-seg',d=>{stage.classList.remove('fan','hide');if(d.behind!=='peek')stage.classList.add(d.behind)});+ document.getElementById('stamp-tog').addEventListener('change',e=>{stamps=e.target.checked;follow(dx)});+ slowTog.addEventListener('change',()=>stage.style.setProperty('--sp',slowTog.checked?3:1));+ build();measure();+</script>+</body>+</html>diff --git a/animations/04-micro-interactions/magnifier-lens/index.html b/animations/04-micro-interactions/magnifier-lens/index.htmlindex cd3dda2a..99f05f39 100644--- a/animations/04-micro-interactions/magnifier-lens/index.html+++ b/animations/04-micro-interactions/magnifier-lens/index.html@@ -63,7 +63,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="../before-after-slider/" rel="prev" aria-label="Previous: Before/After Slider"><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>Before/After Slider</span></a></span>+ <span class="hb-pager"><a href="../before-after-slider/" rel="prev" aria-label="Previous: Before/After Slider"><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>Before/After Slider</span></a><a href="../card-deck-swipe/" rel="next" aria-label="Next: Card Deck Swipe"><span><span class="hb-dir">Next: </span>Card Deck Swipe</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/04-micro-interactions/swipe-to-dismiss/README.md b/animations/04-micro-interactions/swipe-to-dismiss/README.mdindex 81897db8..1807bb44 100644--- a/animations/04-micro-interactions/swipe-to-dismiss/README.md+++ b/animations/04-micro-interactions/swipe-to-dismiss/README.md@@ -60,3 +60,4 @@ Commit is decided by distance **or** velocity — a fast flick counts even if th- [Modal Expand](../modal-expand/) — a window that grows out of the button you pressed- [Button Press Scale](../button-press-scale/) — a button that shrinks as you press it- [Toggle / Switch Slide](../toggle-switch/) — a smaller control that slides and settles+- [Card Deck Swipe](../card-deck-swipe/) — the top card of a pile goes left or right and the next one risesdiff --git a/index.html b/index.htmlindex 52518f5a..5b607c73 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 — 170 Web Animation Techniques with Live Demos</title>-<meta name="description" content="A free visual reference of 170 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 — 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."><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 — 170 Web Animation Techniques with Live Demos">-<meta property="og:description" content="A free visual reference of 170 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 — 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: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 — 170 Web Animation Techniques with Live Demos">-<meta name="twitter:description" content="A free visual reference of 170 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 — 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: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 170 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 171 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"],@@ -1018,6 +1018,17 @@ button,input{font:inherit;color:inherit}@keyframes magnifier-ln{0%,100%{transform:translate(28cqw,34cqh)}33%{transform:translate(70cqw,40cqh)}66%{transform:translate(48cqw,70cqh)}}@keyframes magnifier-mp{0%,100%{transform:translate(calc(17cqw - 56cqw),calc(17cqw - 68cqh)) scale(2)}33%{transform:translate(calc(17cqw - 140cqw),calc(17cqw - 80cqh)) scale(2)}66%{transform:translate(calc(17cqw - 96cqw),calc(17cqw - 140cqh)) scale(2)}}+.pv-deckswipe{background:#0b0b0d;overflow:hidden;container-type:size}+.pv-deckswipe i{position:absolute;left:36%;top:11%;width:28%;height:76%;border-radius:2.6cqw;background:linear-gradient(#0000 62%,#17171c 62%),linear-gradient(160deg,var(--a),var(--b));box-shadow:0 1.5cqw 4cqw rgba(0,0,0,.5);transform-origin:50% 130%}+.pv-deckswipe i::after{content:"";position:absolute;left:12%;right:34%;bottom:11%;height:3cqh;border-radius:1cqw;background:#5a5a63;box-shadow:0 -5cqh 0 #f4f4f2}+.pv-deckswipe .c3{--a:#5ec7c0;--b:#1f5f8b;transform:translateY(5cqh) scale(.9)}+.pv-deckswipe .c2{--a:#f6c85f;--b:#d1495b;animation:deckswipe-next 4s ease-in-out infinite}+.pv-deckswipe .c1{--a:#ff9a76;--b:#7c4dff;animation:deckswipe-top 4s ease-in-out infinite}+.pv-deckswipe .c1 b{position:absolute;left:10%;top:9%;padding:0 1.4cqw;border:.5cqw solid #34c77b;border-radius:1.2cqw;color:#34c77b;font:800 4cqw/1.3 var(--disp);transform:rotate(-14deg);opacity:0;animation:deckswipe-like 4s ease-in-out infinite}+@keyframes deckswipe-top{0%,10%{transform:none;opacity:1}40%{transform:translateX(14cqw) rotate(6deg);opacity:1}62%{transform:translateX(80cqw) rotate(20deg);opacity:1}63%,88%{transform:none;opacity:0}100%{transform:none;opacity:1}}+@keyframes deckswipe-next{0%,42%{transform:translateY(2.5cqh) scale(.95)}60%,88%{transform:none}100%{transform:translateY(2.5cqh) scale(.95)}}+@keyframes deckswipe-like{0%,12%{opacity:0}40%,62%{opacity:1}63%,100%{opacity:0}}+/* ── 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}@@ -1686,7 +1697,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>170 free animations · no coding needed</p>+ <p class="pill"><span class="pill-dot" aria-hidden="true"></span>171 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">@@ -1751,14 +1762,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 170 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 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="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 170 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 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></section><section class="how" id="how" aria-labelledby="how-title">@@ -1776,7 +1787,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">170 web animations with live demos and copyable prompts.</p>+ <p class="foot-t">171 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>@@ -1920,6 +1931,7 @@ const CATS=[['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.'],['magnifier-lens','Magnifier Lens','A lens follows your pointer and shows the picture up close. Best for product photos.'],+ ['card-deck-swipe','Card Deck Swipe','Swipe the top card left or right; the next one rises. Best for quick choices.'],]},{@@ -2023,7 +2035,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','before-after-slider':'beforeafter','magnifier-lens':'magnifier',+ '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','wave-layers':'wavelayers','snow-rain':'snowrain','fireworks':'fireworks','topographic-lines':'topo','light-rays':'rays','game-of-life':'life',@@ -2171,6 +2183,7 @@ const PLACES={'dynamic-island':['load','menu'],'before-after-slider':['imgcard'],'magnifier-lens':['imgcard'],+ 'card-deck-swipe':['imgcard'],// 05'kinetic-typography':['text','intro'],'typewriter-effect':['text','intro'],@@ -2351,6 +2364,7 @@ const FIND={'dynamic-island':['loader card shape','click load loop','grow morph bounce fade'],'before-after-slider':['card','drag','reveal slide'],'magnifier-lens':['card','hover drag','follow grow'],+ 'card-deck-swipe':['card','drag click','slide turn'],// 05'kinetic-typography':['text','load scroll loop','grow slide fade stagger'],'typewriter-effect':['text','load loop scroll','draw stagger'],@@ -2495,6 +2509,7 @@ function pvMarkup(k){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 'magnifier': return '<span class="mp"></span><span class="ln anim"><span class="mp anim"></span></span>';+ case 'deckswipe': return '<i class="c3"></i><i class="c2 anim"></i><i class="c1 anim"><b class="anim">LIKE</b></i>';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>';@@ -2826,7 +2841,7 @@ let shown=[];// under the place label or between two states). Nothing here runs without reduced motion.const STILL={cover:.1,curtain:.6,kinetic:.25,carousel:.1,typewriter:.55,textclip:.7,svgpath:.7,smoke:.3,leak:.7,- flash:.41,blurpage:.2,toggle:.7,shake:.8,hideheader:.72,hilite:.7,splitflap:.7,handwrite:.75,tparticles:.36,circlerev:.25,owipe:.165,pcurl:.44,cubepage:.3,reorder:.4,ascii:.2,phys2d:.6,shatter:.15,izoom:.02,pixelate:.34+ flash:.41,blurpage:.2,toggle:.7,shake:.8,hideheader:.72,hilite:.7,splitflap:.7,handwrite:.75,tparticles:.36,circlerev:.25,owipe:.165,pcurl:.44,cubepage:.3,reorder:.4,ascii:.2,phys2d:.6,shatter:.15,izoom:.02,pixelate:.34,deckswipe:.4};function hold(card){const anims=card.querySelector('.pv').getAnimations({subtree:true});diff --git a/llms.txt b/llms.txtindex d8b8b18a..f3805f2b 100644--- a/llms.txt+++ b/llms.txt@@ -1,8 +1,8 @@# Animation Handbook-> A visual reference of 170 web animation techniques, each with a live demo and a plain-words prompt for building it with an AI assistant.+> 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.-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 170 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 171 prompts and settings at once, install the Agent Skill: `npx skills add matinmonshizadeh/animation-handbook`.## Scroll-Based@@ -117,6 +117,7 @@ Each page plays one technique live and gives a ready-made prompt that describes- [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.- [Magnifier Lens](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/): A lens follows your pointer and shows the picture up close. Best for product photos.+- [Card Deck Swipe](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/): Swipe the top card left or right; the next one rises. Best for quick choices.## Text & Typography@@ -202,11 +203,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 170 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 171 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 43 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 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/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 2ee76a19..ef7ad282 100644Binary files a/og-image.png and b/og-image.png differdiff --git a/sitemap.xml b/sitemap.xmlindex da9c6b07..e01805de 100644--- a/sitemap.xml+++ b/sitemap.xml@@ -82,7 +82,7 @@<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/accordion/</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/cursor-follower/</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/error-shake/</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/swipe-to-dismiss/</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/swipe-to-dismiss/</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/hamburger-menu-toggle/</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/theme-toggle-morph/</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/copy-to-clipboard/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>@@ -104,6 +104,7 @@<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/04-micro-interactions/magnifier-lens/</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/card-deck-swipe/</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 c7396863..d3162149 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 170 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 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.license: MIT---# Animation Handbook-[Animation Handbook](https://matinmonshizadeh.github.io/animation-handbook/) is a free reference of 170 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 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.## 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 170 in one list, grouped by category, with an index by place.+- [references/catalog.md](references/catalog.md): all 171 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, 43 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, 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/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 d9848baf..78648c8c 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. 43 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. 44 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@@ -47,6 +47,7 @@ Short, user-triggered animations — hover, click, focus, loading states, and UI- [Dynamic Island](#dynamic-island)- [Before/After Slider](#beforeafter-slider)- [Magnifier Lens](#magnifier-lens)+- [Card Deck Swipe](#card-deck-swipe)## Hover State Animation@@ -892,3 +893,23 @@ Add a magnifier lens to [the product photo or detailed picture people want to in- Zoom: 2 times · **3 times** · 4 times. How many times bigger the copy in the lens is than the picture: 2 times, 3 times or 4 times.- Lens size: Small · **Medium** · Large. How wide the lens is: small is 110 pixels across, medium 150 and large 200, a fifth less on phones.- Lens shape: **Round** · Square. Round is a circle; square is a square with slightly rounded corners, which suits maps and plans.++## Card Deck Swipe++Swipe the top card left or right; the next one rises. Best for quick choices.++- Live demo: https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/+- How it runs: reacts to the visitor+- Good for: Matching apps · Product pickers · Flashcards · Quick polls+- Avoid on: Lists people compare · Choices that need care++**Prompt**++Add a swipeable card deck to [your stack of cards, such as profiles or products]. Pile the cards with the waiting ones behind the top one, showing as the settings choose. While dragged, the top card follows the finger and turns as the settings choose, as if held at its bottom edge, and Like or Nope stamps fade in when the settings include them. On release, send it off that side if it went far enough or was flicked; otherwise spring it back, and grow the next card into place. Use transforms and pointer events, let up-and-down scrolling pass through, and add Nope, Like and Undo buttons for keyboards. If the visitor has reduced motion turned on, fade cards out instead of throwing them. 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):++- How far to swipe: Short · **Medium** · Long. How far the card's middle must go before letting go sends it: short is a quarter of the card's width, medium 40% and long 60%; a quick flick sends it from anywhere.+- How much it turns: None · **A little** · A lot. How far the card turns for each card width of drag, around a point below its bottom edge: none does not turn, a little turns 14 degrees and a lot 30 degrees.+- Shows stamps: **on** · off. Like in green and Nope in red fade in on the card as it is dragged, fully shown at the swipe distance.+- Cards behind: **Peeking** · Fanned · Hidden. How the waiting cards show: peeking sets each one a little lower and 5% smaller, fanned turns them 5 degrees left or right in turn around the same low point, hidden shows only the top card until the next one grows in.diff --git a/skills/animation-handbook/references/catalog.md b/skills/animation-handbook/references/catalog.mdindex 649ec4dc..45e8fee2 100644--- a/skills/animation-handbook/references/catalog.md+++ b/skills/animation-handbook/references/catalog.md@@ -1,6 +1,6 @@# Catalog-All 170 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 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.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. 43 animations, in [04-micro-interactions.md](04-micro-interactions.md).+Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns. 44 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.@@ -125,6 +125,7 @@ Short, user-triggered animations — hover, click, focus, loading states, and UI- [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.- [Magnifier Lens](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/): A lens follows your pointer and shows the picture up close. Best for product photos. Places: Images & cards.+- [Card Deck Swipe](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/card-deck-swipe/): Swipe the top card left or right; the next one rises. Best for quick choices. Places: Images & cards.## 05 · Text & Typography@@ -215,7 +216,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** (48): 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, 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** (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- **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 fc0f7bee..367f8dda 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', 'before-after-slider', 'magnifier-lens'],+ '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']};