Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

feat: Magnifier Lens (04.43), a new Micro-Interactions page

matinc0db6a8f43b3
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
index 1e8676d9..08c814e2 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 handbook
url: https://matinmonshizadeh.github.io/animation-handbook/
- about: See all 169 techniques running before filing an issue.
+ about: See all 170 techniques running before filing an issue.
- name: Ask a question or share an idea
url: https://github.com/matinmonshizadeh/animation-handbook/discussions
about: Questions, ideas and things you made with the handbook go to Discussions.
diff --git a/404.html b/404.html
index f62412d3..c6cd88ad 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 169 animations</a>
+ <a class="way" href="/animation-handbook/?view=all#results">Browse all 170 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.md
index bccf7cb7..3e27458c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,8 @@ The main steps of Animation Handbook, newest first, with the number of animation
See 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.
+- A new animation, Magnifier Lens (170 in all): a lens follows your pointer and shows the picture up close, with See inside
+ and Compare from the start.
## 1.0.0 — 2026-10-10
diff --git a/README.md b/README.md
index 63c57a65..5fbae596 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 169 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 170 web animation techniques" width="820"></picture></a>
# Animation Handbook
-**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.**
+**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.**
[**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
```
-[![Live site](https://img.shields.io/website?url=https%3A%2F%2Fmatinmonshizadeh.github.io%2Fanimation-handbook%2F&label=live%20demo&up_message=online&color=91bdff)](https://matinmonshizadeh.github.io/animation-handbook/) [![Stars](https://img.shields.io/github/stars/matinmonshizadeh/animation-handbook?style=flat&color=79de9d)](https://github.com/matinmonshizadeh/animation-handbook) [![License](https://img.shields.io/github/license/matinmonshizadeh/animation-handbook?color=c6a1ff)](LICENSE) [![Techniques](https://img.shields.io/badge/techniques-169-ff9d5c)](#full-catalog) [![Dependencies](https://img.shields.io/badge/dependencies-0-ff94a9)](#design-principles) [![Build](https://img.shields.io/badge/build-none-62ddcf)](#design-principles)
+[![Live site](https://img.shields.io/website?url=https%3A%2F%2Fmatinmonshizadeh.github.io%2Fanimation-handbook%2F&label=live%20demo&up_message=online&color=91bdff)](https://matinmonshizadeh.github.io/animation-handbook/) [![Stars](https://img.shields.io/github/stars/matinmonshizadeh/animation-handbook?style=flat&color=79de9d)](https://github.com/matinmonshizadeh/animation-handbook) [![License](https://img.shields.io/github/license/matinmonshizadeh/animation-handbook?color=c6a1ff)](LICENSE) [![Techniques](https://img.shields.io/badge/techniques-170-ff9d5c)](#full-catalog) [![Dependencies](https://img.shields.io/badge/dependencies-0-ff94a9)](#design-principles) [![Build](https://img.shields.io/badge/build-none-62ddcf)](#design-principles)
</div>
@@ -22,7 +22,7 @@ npx skills add matinmonshizadeh/animation-handbook
## What this is
-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.
+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.
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) | 42 |
+| 04 | [Micro-Interactions](#04) | 43 |
| 05 | [Text & Typography](#05) | 19 |
| 06 | [3D & Advanced](#06) | 26 |
| 07 | [Ambient & Background](#07) | 23 |
## Full catalog
-All 169 techniques, each linked to its live demo.
+All 170 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 · 42 techniques
+### 04 · Micro-Interactions · 43 techniques
<sub>Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns.</sub>
-<details><summary>Browse all 42 techniques in Micro-Interactions</summary>
+<details><summary>Browse all 43 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.
@@ -215,6 +215,7 @@ Each technique's code and README are in its folder under [animations/](animation
- **[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.
+- **[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.
</details>
diff --git a/animations/04-micro-interactions/README.md b/animations/04-micro-interactions/README.md
index 4b7760f7..7d2f6e26 100644
--- a/animations/04-micro-interactions/README.md
+++ b/animations/04-micro-interactions/README.md
@@ -48,6 +48,7 @@ Short, user-triggered animations that provide feedback, confirm actions, and com
| [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. |
+| [Magnifier Lens](magnifier-lens/) | A lens follows your pointer and shows the picture up close. Best for product photos. |
## Key concepts
diff --git a/animations/04-micro-interactions/before-after-slider/README.md b/animations/04-micro-interactions/before-after-slider/README.md
index 61fc2b1e..39018ed6 100644
--- a/animations/04-micro-interactions/before-after-slider/README.md
+++ b/animations/04-micro-interactions/before-after-slider/README.md
@@ -51,3 +51,4 @@ A press that does not move glides the line to it, eased by the time that passes.
- [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 itself
+- [Magnifier Lens](../magnifier-lens/) — a lens follows the pointer and shows the picture up close
diff --git a/animations/04-micro-interactions/before-after-slider/index.html b/animations/04-micro-interactions/before-after-slider/index.html
index 0e4f1457..b1717145 100644
--- a/animations/04-micro-interactions/before-after-slider/index.html
+++ b/animations/04-micro-interactions/before-after-slider/index.html
@@ -88,7 +88,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="../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>
+ <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><a href="../magnifier-lens/" rel="next" aria-label="Next: Magnifier Lens"><span><span class="hb-dir">Next: </span>Magnifier Lens</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/magnifier-lens/README.md b/animations/04-micro-interactions/magnifier-lens/README.md
new file mode 100644
index 00000000..b9bcfaa2
--- /dev/null
+++ b/animations/04-micro-interactions/magnifier-lens/README.md
@@ -0,0 +1,44 @@
+# Magnifier Lens
+
+[Live demo](https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/)
+
+## What it is
+A magnifier lens shows part of a picture up close: a round or square window follows the pointer and holds an enlarged copy of the picture, placed so the spot under the pointer sits in the lens's middle. It lets people read fine print and check small details without leaving the page or opening a bigger picture.
+
+## When to use it
+- Product photos: stitching, textures, engravings, labels
+- Maps and floor plans with small names and numbers
+- Artwork and photography, to look at brushwork or grain
+- Technical drawings, diagrams and detailed plans
+
+## How it works
+The lens is a small box with rounded corners and hidden overflow, moved to the pointer by a transform. Inside it sits a second copy of the picture, as many times bigger as the zoom. The copy moves the other way, so the point under the pointer lands in the lens's middle:
+
+```js
+lens.style.transform = `translate(${x - R}px, ${y - R}px)`; // x, y: the pointer on the picture; R: the lens's radius
+copy.style.transform = `translate(${R - x * Z}px, ${R - y * Z}px)`; // Z: the zoom
+```
+
+The copy is drawn at its full bigger size, not scaled up with a transform: a layer that is scaled up after it is drawn shows a stretched, blurry picture. Here the drawing is vector, so the bigger copy stays sharp; with photos, the lens loads a larger version of the image. The lens grows in when the pointer arrives and shrinks away when it leaves, a short transition on the lens's scale. A finger shows the lens while it is down, just above the finger so the finger does not cover it, with `touch-action: none` so the drag moves the lens instead of the page. From the keyboard the picture takes focus, which shows the lens in the middle; the arrow keys move it (Shift for bigger steps) and Escape puts it away. Under reduced motion the lens appears and goes without growing, and Show me jumps between the details.
+
+## Key parameters
+| Parameter | Default | Effect |
+|-----------|---------|--------|
+| Zoom | 3 times | How many times bigger the copy in the lens is than the picture: 2 times, 3 times or 4 times |
+| Lens size | Medium | How wide the lens is: small is 110 pixels across, medium 150 and large 200, a fifth less on phones |
+| Lens shape | Round | Round is a circle; square is a square with slightly rounded corners, which suits maps and plans |
+
+## Production notes
+- **Use a bigger image.** Stretching the same small image only enlarges its pixels and the detail blurs; load a version two to four times larger (with `srcset`, or lazily when the pointer first arrives) and use it as the lens's copy or as its background.
+- **Size it, then move it.** Give the copy its final size in layout and move it only with transforms; scaling it up with a transform after the browser has drawn it as a layer blurs it.
+- **Background-image variant.** A lens can also be a single element whose background is the large image, moved with `background-position`; that repaints the lens on every move, which is fine for small lenses.
+- **Touch and keyboard.** Show the lens above the finger, flip it below near the top edge, and give keyboard users focus, arrow keys and Escape.
+- **Libraries.** Drift, Zoomist and many shop themes package the same idea; in a React app, react-medium-image-zoom or a small custom hook does it.
+- **Reduced motion.** Let the lens appear and go at once instead of growing.
+
+## See also
+- [Spotlight Hover Glow](../spotlight-hover/) — a light follows the pointer across cards
+- [Cursor Follower](../cursor-follower/) — a shape trails the pointer, from the keyboard too
+- [Liquid Glass](../../06-3d-advanced/liquid-glass/) — a panel bends the picture behind it at its rim
+- [Image Distortion on Hover](../../06-3d-advanced/image-distortion-hover/) — the picture warps near the pointer
+- [Before/After Slider](../before-after-slider/) — a line dragged across two pictures uncovers one over the other
diff --git a/animations/04-micro-interactions/magnifier-lens/index.html b/animations/04-micro-interactions/magnifier-lens/index.html
new file mode 100644
index 00000000..a9aa82a7
--- /dev/null
+++ b/animations/04-micro-interactions/magnifier-lens/index.html
@@ -0,0 +1,377 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Magnifier Lens — Animation Handbook</title>
+ <meta name="description" content="A lens follows your pointer and shows the picture up close. Best for product photos.">
+ <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/">
+ <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="Magnifier Lens — Animation Handbook">
+ <meta property="og:description" content="A lens follows your pointer and shows the picture up close. Best for product photos.">
+ <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/">
+ <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="Magnifier Lens — Animation Handbook">
+ <meta name="twitter:description" content="A lens follows your pointer and shows the picture up close. Best for product photos.">
+ <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": "Magnifier Lens", "name": "Magnifier Lens", "description": "A lens follows your pointer and shows the picture up close. Best for product photos.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/", "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, Magnifier Lens"}</script>
+ <style>
+ :root{--ui-accent:#ff9d5c}
+ *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
+ /* --r: the lens's radius; --s: how far See inside zooms out; --grow: how long the lens takes to grow in or shrink away */
+ .stage{--r:75px;--s:.3;--grow:.22s;position:relative;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);background:#0b0d13;touch-action:none;-webkit-user-select:none;user-select:none}
+ .stage svg{font-family:var(--hb-font)}
+ .defs{position:absolute;width:0;height:0;overflow:hidden}
+ .mag{position:relative;min-width:0;overflow:hidden;cursor:crosshair}
+ .world{position:absolute;inset:0}
+ .pic,.whole{position:absolute;left:0;top:0;display:block;width:100%;height:100%}
+ /* The lens: a window moved to the pointer by a transform, holding a copy as many times bigger as the zoom (drawn at that size,
+ so it stays sharp) that moves the other way, so the spot under the pointer sits in its middle */
+ .lens{position:absolute;left:0;top:0;width:calc(var(--r) * 2);height:calc(var(--r) * 2);pointer-events:none;will-change:transform}
+ .glass{position:relative;width:100%;height:100%;border-radius:50%;overflow:hidden;background:#0b0d13;box-shadow:0 10px 28px rgba(0,0,0,.55);transform:scale(0);transition:transform var(--grow) cubic-bezier(.2,.8,.2,1)}
+ .glass::after{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 2px rgba(255,255,255,.85),inset 0 0 16px rgba(0,0,0,.35)}
+ .square .glass{border-radius:14px}
+ .lens-on .glass{transform:scale(1)}
+ .zoom{position:absolute;left:0;top:0;display:block;will-change:transform}
+ /* See inside and Compare: plain words over the stage */
+ .whole,.cross,.twin,.cap{display:none}
+ .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}
+ /* See inside: zoomed out so the bigger copy fits, drawn whole but faint and outlined, with a cross on the pointer's spot */
+ .stage[data-hb-mode="inside"] .mag{overflow:visible}
+ .stage[data-hb-mode="inside"] .world{transform:scale(var(--s))}
+ .stage[data-hb-mode="inside"] .whole{display:block;opacity:.32;outline:calc(2px / var(--s)) dashed rgba(255,255,255,.7)}
+ .stage[data-hb-mode="inside"] .pic{outline:calc(2px / var(--s)) solid rgba(255,255,255,.75)}
+ .stage[data-hb-mode="inside"] .cross{display:block}
+ .cross{position:absolute;left:0;top:0;width:20px;height:20px;margin:-10px 0 0 -10px;pointer-events:none}
+ .cross::before,.cross::after{content:"";position:absolute;left:8px;top:0;width:4px;height:20px;border-radius:2px;background:var(--ui-accent);box-shadow:0 0 0 1.5px #0b0d13}
+ .cross::after{transform:rotate(90deg)}
+ /* Compare: a copy whose lens stretches a small picture of the watch beside the real one; one pointer moves both */
+ .stage[data-hb-mode="compare"]{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:4px}
+ .stage[data-hb-mode="compare"] .twin{display:block}
+ .cap.half{top:8px}.cap.first{left:8px}.cap.second{left:calc(50% + 10px)}
+ @media(prefers-reduced-motion:reduce){.glass{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="../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>
+ <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.43 · Micro-Interactions</p>
+ <h1>Magnifier Lens</h1>
+ <p class="hb-lede">A lens follows your pointer and shows the picture up close. Best for product photos.</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">Hover it</h2><p>Point at the watch or touch it, 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>
+ <radialGradient id="mg-bg" cx=".5" cy=".45" r=".7"><stop offset="0" stop-color="#2a3145"/><stop offset="1" stop-color="#0b0d13"/></radialGradient>
+ <linearGradient id="mg-case" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#eef0f4"/><stop offset=".5" stop-color="#9aa0ad"/><stop offset="1" stop-color="#d9dce3"/></linearGradient>
+ <radialGradient id="mg-dial" cx=".45" cy=".4" r=".75"><stop offset="0" stop-color="#2b3f78"/><stop offset="1" stop-color="#121a36"/></radialGradient>
+ <!-- A made-up watch: its maker's name, a date window, a small seconds dial and two lines of fine print that need the lens -->
+ <symbol id="mg-watch" viewBox="0 0 1000 500">
+ <rect width="1000" height="500" fill="url(#mg-bg)"/>
+ <g transform="translate(100 0)">
+ <path d="M332 0H468L460 112H340ZM340 388H460L468 500H332Z" fill="#6b3f26"/>
+ <path d="M346 0 351 106M454 0 449 106M351 394 346 500M449 394 454 500" fill="none" stroke="#d9a877" stroke-width="2" stroke-dasharray="6 5"/>
+ <rect x="560" y="234" width="24" height="32" rx="5" fill="#a7acb8"/>
+ <circle cx="400" cy="250" r="168" fill="url(#mg-case)"/>
+ <circle cx="400" cy="250" r="152" fill="url(#mg-dial)"/>
+ <circle cx="400" cy="250" r="142" fill="none" stroke="#cfd8ee" stroke-width="7" stroke-dasharray="1.2 13.67" stroke-dashoffset=".6"/>
+ <circle cx="400" cy="250" r="132" fill="none" stroke="#f4efe2" stroke-width="16" stroke-dasharray="4 65.12" stroke-dashoffset="2"/>
+ <text x="400" y="188" text-anchor="middle" font-size="24" font-weight="800" letter-spacing="5" fill="#f4efe2">NORDVEL</text>
+ <text x="400" y="205" text-anchor="middle" font-size="7.5" font-weight="600" letter-spacing="2.5" fill="#d8c79c">AUTOMATIC · CHRONOMETER</text>
+ <rect x="494" y="237" width="36" height="26" rx="3" fill="#f7f3ea"/>
+ <text x="512" y="256" text-anchor="middle" font-size="17" font-weight="700" fill="#1b2340">14</text>
+ <circle cx="400" cy="300" r="30" fill="#16203f" stroke="#d8c79c" stroke-width="1.5"/>
+ <circle cx="400" cy="300" r="25" fill="none" stroke="#cfd8ee" stroke-width="4" stroke-dasharray="1 9.47"/>
+ <text x="400" y="288" text-anchor="middle" font-size="5.5" fill="#d8c79c">60</text>
+ <text x="416" y="302" text-anchor="middle" font-size="5.5" fill="#d8c79c">20</text>
+ <text x="384" y="302" text-anchor="middle" font-size="5.5" fill="#d8c79c">40</text>
+ <path d="M400 300 409 285" stroke="#e2553f" stroke-width="1.5" stroke-linecap="round"/>
+ <text x="400" y="348" text-anchor="middle" font-size="5" font-weight="600" letter-spacing="1" fill="#d8c79c">25 JEWELS · WATER RESIST 100 M</text>
+ <text x="400" y="357" text-anchor="middle" font-size="5" font-weight="600" letter-spacing="1" fill="#d8c79c">No. 0417 · MADE BY HAND</text>
+ <path d="M400 250 331 210" stroke="#f4efe2" stroke-width="9" stroke-linecap="round"/>
+ <path d="M400 250 504 190" stroke="#f4efe2" stroke-width="6" stroke-linecap="round"/>
+ <path d="M400 250 513 315" stroke="#e2553f" stroke-width="2.5" stroke-linecap="round"/>
+ <circle cx="400" cy="250" r="8" fill="#d8c79c"/>
+ </g>
+ </symbol>
+ </defs></svg>
+ <div class="mag" id="mag" tabindex="0" role="img" aria-label="A watch with fine print on its face: point at it, touch it or use the arrow keys to see it up close in a lens">
+ <div class="world">
+ <svg class="whole" viewBox="0 0 1000 500" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><use href="#mg-watch" width="1000" height="500"/></svg>
+ <svg class="pic" viewBox="0 0 1000 500" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><use href="#mg-watch" width="1000" height="500"/></svg>
+ <div class="lens"><div class="glass"><svg class="zoom" viewBox="0 0 1000 500" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><use href="#mg-watch" width="1000" height="500"/></svg></div></div>
+ <span class="cross"></span>
+ </div>
+ </div>
+ <p class="cap in" id="c-copy" aria-hidden="true" data-hb-caption>Bigger copy · slides the other way</p>
+ <p class="cap in" id="c-lens" aria-hidden="true" data-hb-caption>Lens · a window onto the copy</p>
+ <p class="cap in" id="c-ptr" aria-hidden="true" data-hb-caption>Pointer</p>
+ <p class="cap half first" aria-hidden="true" data-hb-caption>Stretched copy</p>
+ <p class="cap half second" aria-hidden="true" data-hb-caption>Bigger copy</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>
+ <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 box is zoomed out: the picture sits over a faint, bigger copy of itself. The lens is a window onto that copy, which slides the other way as the lens moves.</p>
+ <p data-hb-for="compare" hidden>On the left the lens stretches the small picture, so the detail blurs. On the right it shows a bigger copy, so the detail stays sharp.</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 point at the watch or press Show me.</p></div>
+ </div>
+ <div class="hb-settings">
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="zoom-lbl">Zoom</p>
+ <div class="seg" id="zoom-seg" role="group" aria-labelledby="zoom-lbl">
+ <button type="button" data-z="2" aria-pressed="false">2 times</button>
+ <button type="button" data-z="3" class="on" aria-pressed="true">3 times</button>
+ <button type="button" data-z="4" aria-pressed="false">4 times</button>
+ </div>
+ <p class="hb-hint">How much bigger things look in the lens.</p>
+ </div>
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="size-lbl">Lens size</p>
+ <div class="seg" id="size-seg" role="group" aria-labelledby="size-lbl">
+ <button type="button" data-r="55" aria-pressed="false">Small</button>
+ <button type="button" data-r="75" class="on" aria-pressed="true">Medium</button>
+ <button type="button" data-r="100" aria-pressed="false">Large</button>
+ </div>
+ <p class="hb-hint">A bigger lens shows more around the spot.</p>
+ </div>
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="shape-lbl">Lens shape</p>
+ <div class="seg" id="shape-seg" role="group" aria-labelledby="shape-lbl">
+ <button type="button" data-shape="round" class="on" aria-pressed="true">Round</button>
+ <button type="button" data-shape="square" aria-pressed="false">Square</button>
+ </div>
+ <p class="hb-hint">Square suits maps and plans.</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 magnifier lens to [the product photo or detailed picture people want to inspect]. While the pointer is over the picture, show a lens there holding an enlarged copy, placed so the spot under the pointer sits in the middle of the lens. Fill the lens from a larger, sharper version of the picture, never the same small one stretched, and move the lens and the copy with transforms only. On touch screens, show it while a finger is down, just above the finger; from the keyboard, show it on focus and move it with the arrow keys. If the visitor has reduced motion turned on, let it appear without growing. 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>Product photos</li><li>Maps</li><li>Artwork</li><li>Detailed plans</li></ul>
+ <h3>Avoid on</h3>
+ <ul class="hb-tags hb-avoid"><li>Small or plain 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'),mag=document.getElementById('mag'),defs=stage.querySelector('.defs'),slowTog=document.getElementById('slow-tog');
+ const reduceMQ=matchMedia('(prefers-reduced-motion: reduce)'),phoneMQ=matchMedia('(max-width:600px),(max-height:500px)');
+ const caps=['c-copy','c-lens','c-ptr'].map(id=>document.getElementById(id));
+ const LABELS={normal:mag.getAttribute('aria-label'),
+ inside:'Zoomed out: the watch small in the middle of a faint, bigger copy, and the lens showing part of that copy',
+ compare:'The watch twice: a lens that stretches a small picture of it, and a lens that shows a bigger, sharp copy'};
+ // The details Show me visits, in the drawing's own units (1000 by 500): the maker's name, the date and the fine print
+ const SPOTS=[[500,192],[612,250],[500,352]];
+ const parts=el=>({el,world:el.querySelector('.world'),lens:el.querySelector('.lens'),zoom:el.querySelector('.zoom'),whole:el.querySelector('.whole'),cross:el.querySelector('.cross'),w:0,h:0});
+ const real=parts(mag);
+ // fx,fy: the spot magnified, as shares of the picture's width and height; lifted: the lens sits above the spot (for a finger)
+ let Z=3,size=75,R=75,mode='normal',twin=null,fx=.5,fy=.5,lifted=false,mouseIn=false,keyed=false,touchId=null,runTimers=[],runFrame=0;
+ const frames=()=>twin&&mode==='compare'?[twin,real]:[real];
+
+ // Sizes: the lens, how far See inside zooms out, and each copy as many times bigger than its picture as the zoom
+ function measure(){
+ R=size*(phoneMQ.matches?.8:1);
+ stage.style.setProperty('--r',R+'px');stage.style.setProperty('--s',.92/Z);stage.style.setProperty('--grow',slowTog.checked?'.66s':'.22s');
+ for(const f of frames()){
+ f.w=f.el.clientWidth;f.h=f.el.clientHeight;
+ for(const c of [f.zoom,f.whole])if(c){c.style.width=f.w*Z+'px';c.style.height=f.h*Z+'px'}
+ }
+ if(twin&&mode==='compare')paintSmall();
+ place();
+ }
+ // The lens over the spot, or just above it for a finger (below it near the top); the copy inside moves the other way by the
+ // zoom, so the spot sits in the lens's middle. In See inside the whole copy and a cross on the spot are drawn too.
+ function place(){
+ for(const f of frames()){
+ if(!f.w)continue;
+ const x=fx*f.w,y=fy*f.h,up=y-R-28,ly=!lifted?y:up>=R*.6?up:y+R+28;
+ f.lens.style.transform=`translate(${x-R}px,${ly-R}px)`;
+ f.zoom.style.transform=`translate(${R-x*Z}px,${R-y*Z}px)`;
+ if(f.whole){f.whole.style.transform=`translate(${x-x*Z}px,${ly-y*Z}px)`;f.cross.style.transform=`translate(${x}px,${y}px) scale(${Z/.92})`}
+ }
+ if(mode==='inside')placeCaps();
+ }
+ const show=on=>stage.classList.toggle('lens-on',on);
+ // A point of the drawing as shares of the picture (the drawing is cut to fill it, as a cover image is)
+ function spot([px,py]){const w=real.w,h=real.h,k=Math.max(w/1000,h/500);return[((w-1000*k)/2+px*k)/w,((h-500*k)/2+py*k)/h]}
+ // At rest: no lens in Normal; See inside holds it in the middle, Compare on the fine print
+ const pose=()=>mode==='inside'?[.5,.5]:spot(SPOTS[2]);
+ function rest(){lifted=false;if(mode==='normal')show(false);else{[fx,fy]=pose();place();show(true)}}
+ const running=()=>runTimers.length>0||runFrame!==0;
+ const idle=()=>!mouseIn&&touchId===null&&!keyed&&!running();
+
+ // The pointer's spot on the picture under it (in Compare either half; one pointer moves both lenses)
+ function aimAt(e){
+ const fs=frames(),f=fs.length>1&&e.clientX<real.el.getBoundingClientRect().left?fs[0]:real,r=f.world.getBoundingClientRect();
+ fx=Math.min(1,Math.max(0,(e.clientX-r.left)/r.width));fy=Math.min(1,Math.max(0,(e.clientY-r.top)/r.height));place();
+ }
+ // A mouse or a pen in the air shows the lens where it points; a finger while it is down, above it (touch-action none keeps the
+ // drag on the picture). A run under way stops first.
+ stage.addEventListener('pointermove',e=>{
+ if(e.pointerType==='touch'){if(e.pointerId===touchId)aimAt(e);return}
+ if(e.isTrusted&&running())stopRun();
+ mouseIn=true;keyed=false;lifted=false;aimAt(e);show(true);
+ });
+ stage.addEventListener('pointerleave',e=>{if(e.pointerType==='touch')return;mouseIn=false;if(e.isTrusted&&running())stopRun();if(idle())rest()});
+ stage.addEventListener('pointerdown',e=>{
+ if(e.pointerType!=='touch'||touchId!==null)return;
+ touchId=e.pointerId;try{stage.setPointerCapture(touchId)}catch(_){}
+ keyed=false;lifted=true;aimAt(e);show(true);
+ });
+ ['pointerup','pointercancel'].forEach(t=>stage.addEventListener(t,e=>{if(e.pointerId===touchId){touchId=null;rest()}}));
+ // The keyboard: focus shows the lens in the middle, the arrows move it (Shift for bigger steps), Escape puts it away
+ mag.addEventListener('focus',()=>{if(!mag.matches(':focus-visible'))return;if(running())stopRun();keyed=true;lifted=false;fx=fy=.5;place();show(true)});
+ mag.addEventListener('blur',()=>{if(keyed){keyed=false;if(idle())rest()}});
+ mag.addEventListener('keydown',e=>{
+ if(e.key==='Escape'){if(keyed){keyed=false;rest()}return}
+ const d={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];
+ if(!d||e.altKey||e.ctrlKey||e.metaKey)return;
+ e.preventDefault();if(running())stopRun();
+ if(!keyed){keyed=true;lifted=false;show(true)}
+ const st=e.shiftKey?.15:.04;fx=Math.min(1,Math.max(0,fx+d[0]*st));fy=Math.min(1,Math.max(0,fy+d[1]*st));place();
+ });
+
+ // The lens glides to a spot by the time that passes (three times as long in slow motion); under reduced motion it jumps
+ function glide(to,ms){
+ cancelAnimationFrame(runFrame);runFrame=0;
+ if(reduceMQ.matches){[fx,fy]=to;place();return}
+ const from=[fx,fy],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),e=k*k*(3-2*k);
+ fx=from[0]+(to[0]-from[0])*e;fy=from[1]+(to[1]-from[1])*e;place();
+ runFrame=k<1?requestAnimationFrame(step):0;
+ if(k>=1&&idle())rest();
+ };
+ runFrame=requestAnimationFrame(step);
+ }
+ // Show me: the lens over the maker's name, the date and the fine print, then away (in See inside and Compare back to its
+ // place). Every pause waits on a timer; 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)}
+ function stopRun(){runTimers.forEach(clearTimeout);runTimers=[];cancelAnimationFrame(runFrame);runFrame=0}
+ document.getElementById('btn-demo').addEventListener('click',()=>{
+ stopRun();keyed=false;lifted=false;
+ const pts=SPOTS.map(spot),view=mode!=='normal',first=view?600:220;
+ if(view)glide(pts[0],600);else{[fx,fy]=pts[0];place();show(true)}
+ later(()=>glide(pts[1],600),first,350);
+ later(()=>glide(pts[2],600),first+600,700);
+ later(()=>{if(mode!=='normal')glide(pose(),600);else show(false)},first+1200,1050);
+ });
+ document.addEventListener('hb:input',()=>{if(running()){stopRun();if(idle())rest()}});
+ stage.addEventListener('focusin',e=>{if(e.isTrusted&&running())stopRun()});
+
+ // See inside's three labels: the lens's above it and the pointer's below it, and the copy's at the first corner of its outline that
+ // leaves the other two clear (the top left, unless the lens is close to it); all are measured before any moves, so the page lays
+ // out once
+ function placeCaps(){
+ const s=stage.getBoundingClientRect(),g=real.lens.firstElementChild.getBoundingClientRect(),c=real.whole.getBoundingClientRect();
+ const size=caps.map(el=>[el.offsetWidth,el.offsetHeight]),mid=(g.left+g.right)/2-s.left;
+ const fit=(i,x,y)=>[Math.max(6,Math.min(s.width-size[i][0]-6,x)),Math.max(6,Math.min(s.height-size[i][1]-6,y))];
+ const hit=(a,i,b,j)=>a[0]<b[0]+size[j][0]&&b[0]<a[0]+size[i][0]&&a[1]<b[1]+size[j][1]&&b[1]<a[1]+size[i][1];
+ const at=[0,fit(1,mid-size[1][0]/2,g.top-s.top-size[1][1]-8),fit(2,mid-size[2][0]/2,g.bottom-s.top+8)];
+ const l=c.left-s.left+8,t=c.top-s.top+8,r=c.right-s.left-8-size[0][0],b=c.bottom-s.top-8-size[0][1];
+ const corners=[[l,t],[l,b],[r,t],[r,b]].map(p=>fit(0,p[0],p[1]));
+ at[0]=corners.find(p=>!hit(p,0,at[1],1)&&!hit(p,0,at[2],2))||corners[0];
+ caps.forEach((el,i)=>{el.style.transform=`translate(${at[i][0]}px,${at[i][1]}px)`});
+ }
+ // Compare's first half: a copy of the watch, made once, with no ids, name or focus, whose lens holds the small picture stretched
+ function makeTwin(){
+ const el=mag.cloneNode(true);el.removeAttribute('id');el.classList.add('twin');el.inert=true;el.setAttribute('aria-hidden','true');
+ ['tabindex','role','aria-label'].forEach(a=>el.removeAttribute(a));
+ const c=document.createElement('canvas');c.className='zoom';el.querySelector('.zoom').replaceWith(c);
+ stage.insertBefore(el,mag);twin=parts(el);
+ }
+ // The small picture: the drawing at one pixel per pixel of its half, as a photo shown at its own size would be; drawn when
+ // Compare first shows and again only when its half changes size (the newest request wins)
+ let painted='',paintSeq=0;
+ function paintSmall(){
+ const w=twin.w,h=twin.h,c=twin.zoom;if(!w||!h||painted===w+'x'+h)return;
+ painted=w+'x'+h;const mine=++paintSeq,img=new Image();
+ img.onload=()=>{if(mine!==paintSeq)return;c.width=w;c.height=h;c.getContext('2d').drawImage(img,0,0,w,h)};
+ img.src='data:image/svg+xml,'+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 1000 500" preserveAspectRatio="xMidYMid slice" font-family="sans-serif">${defs.innerHTML}<use href="#mg-watch" width="1000" height="500"/></svg>`);
+ }
+ // The mode switch draws the mode at once: the copies' sizes for its layout, then its picture at rest
+ document.addEventListener('hb:mode',e=>{
+ mode=e.detail.mode;mag.setAttribute('aria-label',LABELS[mode]);
+ if(mode==='compare'&&!twin)makeTwin();
+ measure();if(idle())rest();
+ });
+ new ResizeObserver(measure).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);measure();
+ }));
+ }
+ choices('zoom-seg',d=>{Z=+d.z});
+ choices('size-seg',d=>{size=+d.r});
+ choices('shape-seg',d=>{stage.classList.toggle('square',d.shape==='square')});
+ slowTog.addEventListener('change',measure);
+ measure();
+</script>
+</body>
+</html>
diff --git a/animations/04-micro-interactions/spotlight-hover/README.md b/animations/04-micro-interactions/spotlight-hover/README.md
index c03f41ad..20795a09 100644
--- a/animations/04-micro-interactions/spotlight-hover/README.md
+++ b/animations/04-micro-interactions/spotlight-hover/README.md
@@ -56,3 +56,4 @@ The grid also takes keyboard focus (`tabindex="0"`), and the light then appears
- [Parallax 3D Tilt](../../06-3d-advanced/parallax-3d-tilt/) — a card that tilts and catches the light
- [Hover State Animation](../hover-state/) — simpler ways for a card to react
- [Animated Gradient Border](../gradient-border/) — an edge with a band of colors that runs on its own
+- [Magnifier Lens](../magnifier-lens/) — a lens follows the pointer and shows the picture up close
diff --git a/index.html b/index.html
index 817102f6..a9cecb0b 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 — 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.">
+<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.">
<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 — 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: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: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 — 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: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: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 169 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 170 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"],
@@ -1010,6 +1010,13 @@ button,input{font:inherit;color:inherit}
@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%)}}
+.pv-magnifier{background:#e9e4d6;overflow:hidden;container-type:size}
+.pv-magnifier .mp{position:absolute;left:0;top:0;width:100cqw;height:100cqh;background:radial-gradient(circle at 72% 28%,#9fcf8a 0 11%,#0000 11.5%),radial-gradient(circle at 24% 74%,#f2c879 0 7%,#0000 7.5%),linear-gradient(115deg,#0000 44%,#8cc3e8 44.5% 53%,#0000 53.5%),repeating-linear-gradient(0deg,#0000 0 14%,#fff 14% 15.5%),repeating-linear-gradient(90deg,#0000 0 11%,#fff 11% 12.5%),#e9e4d6}
+.pv-magnifier .ln{position:absolute;left:0;top:0;width:34cqw;height:34cqw;margin:-17cqw 0 0 -17cqw;border-radius:50%;overflow:hidden;box-shadow:0 0 0 2px #fff,0 6px 16px rgba(0,0,0,.35);animation:magnifier-ln 6s ease-in-out infinite}
+.pv-magnifier .ln .mp{transform-origin:0 0;animation:magnifier-mp 6s ease-in-out infinite}
+@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)}}
+
/* ── 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}
@@ -1677,7 +1684,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>169 free animations · no coding needed</p>
+ <p class="pill"><span class="pill-dot" aria-hidden="true"></span>170 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">
@@ -1742,14 +1749,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 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="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="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 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/&lt;category&gt;/&lt;name&gt;/</code>.</p></noscript>
+ <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/&lt;category&gt;/&lt;name&gt;/</code>.</p></noscript>
</section>
<section class="how" id="how" aria-labelledby="how-title">
@@ -1767,7 +1774,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">169 web animations with live demos and copyable prompts.</p>
+ <p class="foot-t">170 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>
@@ -1910,6 +1917,7 @@ const CATS=[
['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.'],
+ ['magnifier-lens','Magnifier Lens','A lens follows your pointer and shows the picture up close. Best for product photos.'],
]
},
{
@@ -2013,7 +2021,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',
+ 'image-trail':'imgtrail','gooey-menu':'gooey','dynamic-island':'dynisland','before-after-slider':'beforeafter','magnifier-lens':'magnifier',
'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',
@@ -2160,6 +2168,7 @@ const PLACES={
'gooey-menu':['menu','btn'],
'dynamic-island':['load','menu'],
'before-after-slider':['imgcard'],
+ 'magnifier-lens':['imgcard'],
// 05
'kinetic-typography':['text','intro'],
'typewriter-effect':['text','intro'],
@@ -2339,6 +2348,7 @@ const FIND={
'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'],
+ 'magnifier-lens':['card','hover drag','follow grow'],
// 05
'kinetic-typography':['text','load scroll loop','grow slide fade stagger'],
'typewriter-effect':['text','load loop scroll','draw stagger'],
@@ -2482,6 +2492,7 @@ function pvMarkup(k){
'<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 'magnifier': return '<span class="mp"></span><span class="ln anim"><span class="mp anim"></span></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.txt
index 1587753d..d8b8b18a 100644
--- a/llms.txt
+++ b/llms.txt
@@ -1,8 +1,8 @@
# Animation Handbook
-> 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.
+> 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.
-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`.
+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`.
## Scroll-Based
@@ -116,6 +116,7 @@ Each page plays one technique live and gives a ready-made prompt that describes
- [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.
+- [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.
## Text & Typography
@@ -201,11 +202,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 169 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 170 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 42 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 43 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 values
diff --git a/og-image.png b/og-image.png
index b21f417a..093e2571 100644
Binary files a/og-image.png and b/og-image.png differ
diff --git a/sitemap.xml b/sitemap.xml
index dabf82fc..da9c6b07 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -91,7 +91,7 @@
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/segmented-control/</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/pull-to-refresh/</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/gradient-border/</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/spotlight-hover/</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/spotlight-hover/</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/add-to-cart-fly/</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/drag-to-reorder/</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/rolling-numbers/</loc><lastmod>2026-10-15</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
@@ -103,6 +103,7 @@
<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-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/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.md
index de007d62..c7396863 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 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.
+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.
license: MIT
---
# Animation Handbook
-[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.
+[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.
## 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 169 in one list, grouped by category, with an index by place.
+- [references/catalog.md](references/catalog.md): all 170 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, 42 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, 43 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.md
index c7d4d50b..708f3406 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. 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.
+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.
## Contents
@@ -46,6 +46,7 @@ Short, user-triggered animations — hover, click, focus, loading states, and UI
- [Gooey Menu](#gooey-menu)
- [Dynamic Island](#dynamic-island)
- [Before/After Slider](#beforeafter-slider)
+- [Magnifier Lens](#magnifier-lens)
## Hover State Animation
@@ -872,3 +873,22 @@ Add a before-and-after slider to [the two pictures you want to compare]. Stack t
- 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, with nothing showing where to grab (the knob's fingertip-sized grab area stays, unseen, on the middle of the line).
- 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.
+
+## Magnifier Lens
+
+A lens follows your pointer and shows the picture up close. Best for product photos.
+
+- Live demo: https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/magnifier-lens/
+- How it runs: reacts to the visitor
+- Good for: Product photos · Maps · Artwork · Detailed plans
+- Avoid on: Small or plain pictures
+
+**Prompt**
+
+Add a magnifier lens to [the product photo or detailed picture people want to inspect]. While the pointer is over the picture, show a lens there holding an enlarged copy, placed so the spot under the pointer sits in the middle of the lens. Fill the lens from a larger, sharper version of the picture, never the same small one stretched, and move the lens and the copy with transforms only. On touch screens, show it while a finger is down, just above the finger; from the keyboard, show it on focus and move it with the arrow keys. If the visitor has reduced motion turned on, let it appear without growing. 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):
+
+- 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.
diff --git a/skills/animation-handbook/references/catalog.md b/skills/animation-handbook/references/catalog.md
index cb5654d6..649ec4dc 100644
--- a/skills/animation-handbook/references/catalog.md
+++ b/skills/animation-handbook/references/catalog.md
@@ -1,6 +1,6 @@
# Catalog
-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.
+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.
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. 42 animations, in [04-micro-interactions.md](04-micro-interactions.md).
+Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns. 43 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.
@@ -124,6 +124,7 @@ Short, user-triggered animations — hover, click, focus, loading states, and UI
- [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.
+- [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.
## 05 · Text & Typography
@@ -214,7 +215,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** (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
+- **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
- **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 Glow
diff --git a/tests/pages.test.js b/tests/pages.test.js
index 7cd7eed1..4610cefc 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'],
+ '04-micro-interactions': ['cursor-follower', 'hover-state', 'image-trail', 'spotlight-hover', 'magnetic-button', 'click-ripple', 'before-after-slider', 'magnifier-lens'],
'05-text-typography': ['text-particles'],
'06-3d-advanced': ['2-5d-pseudo-3d', 'depth-map-photo', 'holographic-card', 'image-distortion-hover', 'parallax-3d-tilt']
};