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: Shatter Effect (02.14)
matin9403208d27bb
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.ymlindex b8d170bd..d154d8bf 100644--- a/.github/ISSUE_TEMPLATE/config.yml+++ b/.github/ISSUE_TEMPLATE/config.yml@@ -2,4 +2,4 @@ blank_issues_enabled: truecontact_links:- name: Browse the live handbookurl: https://matinmonshizadeh.github.io/animation-handbook/- about: See all 158 techniques running before filing an issue.+ about: See all 159 techniques running before filing an issue.diff --git a/README.md b/README.mdindex 7cfae9a2..b809d835 100644--- a/README.md+++ b/README.md@@ -1,14 +1,14 @@<div align="center">-<a href="https://matinmonshizadeh.github.io/animation-handbook/"><img src="og-image.png" alt="Animation Handbook — 158 web animation techniques with live demos" width="820"></a>+<a href="https://matinmonshizadeh.github.io/animation-handbook/"><img src="og-image.png" alt="Animation Handbook — 159 web animation techniques with live demos" width="820"></a># Animation Handbook-**A visual reference of 158 web animation techniques — every entry is a live, dependency-free demo you can open in the browser and read how it works.**+**A visual reference of 159 web animation techniques — every entry is a live, dependency-free demo you can open in the browser and read how it works.**[**Open the live handbook →**](https://matinmonshizadeh.github.io/animation-handbook/)-[](https://matinmonshizadeh.github.io/animation-handbook/) [](https://github.com/matinmonshizadeh/animation-handbook/stargazers) [](LICENSE)   +[](https://matinmonshizadeh.github.io/animation-handbook/) [](https://github.com/matinmonshizadeh/animation-handbook/stargazers) [](LICENSE)   </div>@@ -35,7 +35,7 @@ Everything is plain HTML, CSS, and JavaScript: no build step, no frameworks, no| # | Category | Count | What's in it ||:--:|----------|:-----:|--------------|| 01 | [Scroll-Based](#01) | 27 | Animations driven by scroll position — parallax, sticky, scrub, snap, and narrative storytelling. |-| 02 | [Entrance & Exit](#02) | 13 | Element-level animations for arriving and departing — fades, slides, reveals, flips, and text staggers. |+| 02 | [Entrance & Exit](#02) | 14 | Element-level animations for arriving and departing — fades, slides, reveals, flips, and text staggers. || 03 | [Page Transitions](#03) | 16 | Full-page transitions between routes or views — crossfades, slides, portals, morphs, and the browser-native API. || 04 | [Micro-Interactions](#04) | 38 | Short, user-triggered animations — hover, click, focus, loading states, and UI feedback patterns. || 05 | [Text & Typography](#05) | 18 | Animations specifically for type — kinetic motion, character-level effects, gradient flows, and word transformations. |@@ -44,7 +44,7 @@ Everything is plain HTML, CSS, and JavaScript: no build step, no frameworks, no## Full catalog-All 158 techniques, each linked to its live demo.+All 159 techniques, each linked to its live demo.<a id="01"></a>@@ -86,7 +86,7 @@ All 158 techniques, each linked to its live demo.<a id="02"></a>-### 02 · Entrance & Exit · 13 techniques+### 02 · Entrance & Exit · 14 techniques<sub>Element-level animations for arriving and departing — fades, slides, reveals, flips, and text staggers.</sub>@@ -105,6 +105,7 @@ All 158 techniques, each linked to its live demo.- **[Flip In](animations/02-entrance-and-exit/flip-in/)** — Swings into view in 3D, like a card turning over. Best for cards and tiles.- **[Bounce In](animations/02-entrance-and-exit/bounce-in/)** — Lands with a springy bounce. Best for badges and success messages.- **[Rotate In](animations/02-entrance-and-exit/rotate-in/)** — Spins into place while it grows. Best for icons, stars and badges.+- **[Shatter Effect](animations/02-entrance-and-exit/shatter-effect/)** — Breaks into pieces that fly apart and fade. Best for galleries and bold exits.</details>diff --git a/animations/02-entrance-and-exit/README.md b/animations/02-entrance-and-exit/README.mdindex a29c7ce7..cc80e870 100644--- a/animations/02-entrance-and-exit/README.md+++ b/animations/02-entrance-and-exit/README.md@@ -17,3 +17,4 @@ Element-level entrance and exit animations — how individual pieces of UI arriv- [Flip In](flip-in/) — Swings into view in 3D, like a card turning over. Best for cards and tiles.- [Bounce In](bounce-in/) — Lands with a springy bounce. Best for badges and success messages.- [Rotate In](rotate-in/) — Spins into place while it grows. Best for icons, stars and badges.+- [Shatter Effect](shatter-effect/) — Breaks into pieces that fly apart and fade. Best for galleries and bold exits.diff --git a/animations/02-entrance-and-exit/rotate-in/index.html b/animations/02-entrance-and-exit/rotate-in/index.htmlindex eda43d9a..5bac1fd8 100644--- a/animations/02-entrance-and-exit/rotate-in/index.html+++ b/animations/02-entrance-and-exit/rotate-in/index.html@@ -37,7 +37,7 @@<body class="hb" data-hb-kind="once" 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="../bounce-in/" rel="prev" aria-label="Previous: Bounce In"><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>Bounce In</span></a></span>+ <span class="hb-pager"><a href="../bounce-in/" rel="prev" aria-label="Previous: Bounce In"><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>Bounce In</span></a><a href="../shatter-effect/" rel="next" aria-label="Next: Shatter Effect"><span><span class="hb-dir">Next: </span>Shatter Effect</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a></span></nav><main class="hb-page"><header class="hb-head">diff --git a/animations/02-entrance-and-exit/shatter-effect/README.md b/animations/02-entrance-and-exit/shatter-effect/README.mdnew file mode 100644index 00000000..139643e0--- /dev/null+++ b/animations/02-entrance-and-exit/shatter-effect/README.md@@ -0,0 +1,71 @@+# Shatter Effect++## What it is++A shatter effect breaks an element into sharp pieces that fly apart and fade, as if it were a pane of glass hit at one point. Each piece is a copy of the whole card trimmed to its own shape, so together the pieces look exactly like the card until they move. Here the next card fades in behind them, so the break doubles as the change from one card to the next.++## When to use it+- Photo galleries and slideshows, where breaking the current picture brings in the next one+- Dismissing a card with some drama: a deleted item, a closed offer, a finished task+- Game moments and quizzes: a wrong answer, a broken block, a cleared level+- A bold intro, where a cover breaks away to show the page behind it+- Moments that happen once per visit or per action, not things people see over and over++## How it works+The card is cut like glass hit at one point. Rays run from the point of impact to the card's edge, always through the four corners (so the outer pieces end exactly on the edge) and spread evenly in between; rings cross the rays at growing fractions of the distance to the edge, and every crack from one ring to the next bends once, part way along. A piece is the area between two neighboring rays and two neighboring rings. Neighbors share their corners and bends, so the pieces tile the card with no gaps:++```js+const grid=[rays.map(()=>p),...f.map((k,i)=>rays.map(a=>{+ const r=edge(a)*(i<f.length-1?k*rnd(.88,1.12):1);+ return [p[0]+Math.cos(a)*r,p[1]+Math.sin(a)*r]}))];+for(let i=0;i<f.length;i++)rays.forEach((_,k)=>{const n=(k+1)%rays.length;+ polys.push([grid[i][k],bends[i][k],grid[i+1][k],grid[i+1][n],bends[i][n]].concat(i?[grid[i][n]]:[]))});+```++Every piece is a box around its polygon that holds a copy of the whole card (`cloneNode(true)`), shifted so the copy lines up with the original and clipped to the polygon with `clip-path`. Each polygon is grown by 0.7px so neighbors overlap and no seam shows. The pieces are built when the play starts, before anything moves, because that is the costly part; they wait under the card, which is hidden at the break by a zero-length animation, so it keeps time with the pieces' own animations however long that first frame takes:++```js+const el=document.createElement('div'),copy=card.cloneNode(true);+el.style.cssText='left:'+(X+bx)+'px;top:'+(Y+by)+'px;width:'+(Math.ceil(Math.max(...xs))-bx)+'px;height:'+(Math.ceil(Math.max(...ys))-by)+'px;'++ 'transform-origin:'+(c[0]-bx)+'px '+(c[1]-by)+'px;clip-path:polygon('+pts.map(([x,y])=>(x-bx).toFixed(1)+'px '+(y-by).toFixed(1)+'px')+')';+copy.style.cssText='left:'+(-bx)+'px;top:'+(-by)+'px;width:'+W+'px;height:'+H+'px';+```++Each flight is worked out once and sampled into 13 keyframes for the Web Animations API, so the browser plays it by elapsed time and only moves, turns and fades the pieces. Over the flight time `u` (0 to 1) the burst away from the impact slows down (`e` is an ease-out), the upward throw is part of the starting speed, and gravity adds `g·u²/2`; the piece turns all the way and fades over the second half:++```js+for(let k=0;k<=12;k++){+ const u=k/12,e=1-Math.pow(1-u,1.7),x=vx*e,y=vy*e+g*u*u/2;+ frames.push({opacity:u<.5?1:1-Math.pow((u-.5)*2,1.5),transform:tumble+ ?'translate3d('+x+'px,'+y+'px,'+vz*e+'px) rotateX('+spin[0]*u+'deg) rotateY('+spin[1]*u+'deg) rotate('+spin[2]*u+'deg)'+ :'translate('+x+'px,'+y+'px) rotate('+spin[2]*u+'deg)'});+}+el.animate(frames,{duration:T,delay:start+wave*d/far,fill:'both'});+```++Each piece waits until the break (`start`, the time the cracks take), then a little longer the farther it is from the impact, so the break spreads outward; a short flash marks the impact. With the cracks shown, the crack lines are first drawn in an SVG over the card, ring by ring, while the card gives a small jolt; the copies carry the lines, so every piece keeps a light edge where it broke (on a flying piece only a soft light line, since a thin two-tone line breaks up into a sawtooth once the piece tilts). The next card fades in from 45% of the flight. When the last piece has faded, the pieces are removed; Replay or a setting change cancels everything still running (`getAnimations({subtree:true})`) and starts the same break over. Under reduced motion the next card simply fades in over the old one, with no pieces. Slow motion makes the play three times longer; the hold between plays while Loop is on stays the same.++## Key parameters++| Parameter | Default | Effect |+|-----------|---------|--------|+| Number of pieces | Medium | How finely the card breaks: few is about 15 pieces in two rings, medium about 30 in three and many 60 in four (about 46 on phones) |+| Breaks from | Center | Where the impact is: near the middle (moved a little at random each time) or near the top-left corner; the pieces there are the smallest and fly first |+| Gravity | Normal | None lets the pieces drift straight outward; normal throws them up a little before they fall; heavy drops them out of view |+| Speed | Normal | How long each piece's flight takes: slow is 1700ms, normal 1100ms and fast 700ms; the cracks take about a third of that before the break |+| Shows the cracks | on | Draws the cracks across the card, ring by ring from the impact, before it breaks; off, it breaks at once |+| Tumbles in 3D | on | The pieces flip over and fly toward the viewer; off, they spin flat |++## Production notes+- **Copies are the cost.** Each piece holds a full copy of the card, so sixty pieces mean sixty copies of its markup. Keep the card light (one picture and a short caption), make the copies only for the card that is about to break and remove them once they have faded. The demo cuts Many a little coarser on phones (a screen up to 600px wide or 500px tall).+- **Composited, not repainted.** The pieces animate only `transform` and `opacity`; each `clip-path` is set once and never animated. `contain: layout paint` on each piece keeps its layer to its own small box instead of the whole card.+- **Build early, swap on the same clock.** Making the copies and starting their animations takes the most time, so do it before anything moves (here while the card is still whole) and keep the pieces under the card. Hide the card with an animation too, not a timer: animations made together start together, while a timer keeps running during a slow first frame and would hide the card too early.+- **Pictures and video.** A copied `img` shows the same cached picture, but a copied `video` or `canvas` does not carry its current frame: draw that frame to an image first. For any element, html2canvas can turn it into one bitmap that the pieces share as a background, which is also lighter than copying markup.+- **Accessibility.** The pieces are decoration: keep them hidden from assistive technology (here they sit inside the stage's `role="img"`) and move focus to whatever comes next yourself.+- **Library equivalents.** GSAP throws the pieces with `gsap.to(pieces, { x, y, rotation, opacity, stagger: { each, from: 'center' } })`, and its Physics2DPlugin adds gravity and velocity; Framer Motion animates each piece's `x`, `y` and `rotate` with a per-piece delay. For hundreds of pieces, or glass that bends the light, a WebGL library such as Three.js draws the card as a texture on triangles.++## See also+- [Dissolve Transition](../../03-page-transitions/dissolve/) — a page breaks into tiles that give way to the next one+- [Split Text Reveal](../split-text-reveal/) — text broken into pieces that arrive one after another+- [Fade In / Fade Out](../fade-in-out/) — the plain fade this effect becomes under reduced motion+- [2D Physics](../../06-3d-advanced/physics-2d/) — balls that fall, bounce and pile up under gravitydiff --git a/animations/02-entrance-and-exit/shatter-effect/index.html b/animations/02-entrance-and-exit/shatter-effect/index.htmlnew file mode 100644index 00000000..4d719971--- /dev/null+++ b/animations/02-entrance-and-exit/shatter-effect/index.html@@ -0,0 +1,298 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Shatter Effect — Animation Handbook</title>+ <meta name="description" content="Breaks into pieces that fly apart and fade. Best for galleries and bold exits.">+ <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/shatter-effect/">+ <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="Shatter Effect — Animation Handbook">+ <meta property="og:description" content="Breaks into pieces that fly apart and fade. Best for galleries and bold exits.">+ <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/shatter-effect/">+ <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="Shatter Effect — Animation Handbook">+ <meta name="twitter:description" content="Breaks into pieces that fly apart and fade. Best for galleries and bold exits.">+ <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": "Shatter Effect", "name": "Shatter Effect", "description": "Breaks into pieces that fly apart and fade. Best for galleries and bold exits.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/shatter-effect/", "inLanguage": "en", "articleSection": "Entrance & Exit", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Entrance & Exit, Shatter Effect"}</script>+ <style>+ :root{--ui-accent:#5fd88a;--stage-bg:#0b0c10;--card-bg:#f4f1ea;--card-ink:#16171b;--card-dim:#4b4e57}+ *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}+ .stage{position:relative;overflow:hidden;background:var(--stage-bg)}+ /* The deck fills the stage, and every size on a card is measured in its height (cqh), so a copy of a card matches it exactly */+ .deck{position:absolute;inset:0;display:grid;place-items:center;container-type:size}+ .card{grid-area:1/1;position:relative;display:flex;flex-direction:column;height:78cqh;aspect-ratio:4/5;padding:2.6cqh 2.6cqh 0;border-radius:3.4cqh;+ background:var(--card-bg);color:var(--card-ink);box-shadow:0 2.6cqh 6cqh -1.4cqh rgba(0,0,0,.65);opacity:0;visibility:hidden}+ .card.on{opacity:1;visibility:visible}+ .pic{position:relative;flex:1;border-radius:2cqh;overflow:hidden}+ .pic svg{position:absolute;inset:0;width:100%;height:100%}+ .night{background:linear-gradient(#06112b,#0d2a55 52%,#16507a)}.dunes{background:linear-gradient(#3a1d5c,#b8476f 40%,#f39a5e 72%,#ffd59c)}.cove{background:linear-gradient(#3d9cf0,#a3d7ff 58%)}+ .cap{padding:2.2cqh .6cqh 2.8cqh}+ .cap b{display:block;font-size:max(15px,4.6cqh);font-weight:800;line-height:1.15;letter-spacing:-.01em}+ .cap span{display:block;margin-top:.5cqh;font-size:max(12px,3.1cqh);color:var(--card-dim)}+ /* The cracks: a dark line under a light one, so they show on the picture and on the caption */+ .cracks{position:absolute;inset:0;width:100%;height:100%;border-radius:inherit;pointer-events:none}+ .cracks path{fill:none;stroke-linecap:round;stroke-linejoin:round}.cracks .dk{stroke:rgba(6,8,16,.6);stroke-width:2.8}.cracks .lt{stroke:rgba(255,255,255,.9);stroke-width:1.2}+ .flash{position:absolute;z-index:3;width:34cqh;aspect-ratio:1;margin:-17cqh 0 0 -17cqh;border-radius:50%;opacity:0;pointer-events:none;+ background:radial-gradient(closest-side,#fff,rgba(255,255,255,.55) 35%,rgba(255,255,255,0))}+ /* A piece is a box around its polygon, holding a copy of the whole card clipped to that polygon. The pieces wait under+ the cracking card (z-index 2) until the break and fly in front of the next card. */+ .shards{position:absolute;z-index:1;inset:0;perspective:900px;pointer-events:none}+ .shard{position:absolute;contain:layout paint;will-change:transform,opacity}+ .shard .card{position:absolute;box-shadow:none}+ /* On a flying piece the crack is one soft light edge: a thin two-tone line breaks up into a sawtooth once the piece tilts */+ .shard .cracks .dk{display:none}.shard .cracks .lt{stroke:rgba(255,255,255,.75);stroke-width:2.6}+ </style>+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=6">+ <script src="../../../assets/js/demo-page.js?v=6" defer></script>+</head>+<body class="hb" data-hb-kind="once" 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="../rotate-in/" rel="prev" aria-label="Previous: Rotate In"><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>Rotate In</span></a></span>+</nav>+<main class="hb-page">+ <header class="hb-head">+ <p class="hb-cat">02.14 · Entrance & Exit</p>+ <h1>Shatter Effect</h1>+ <p class="hb-lede">Breaks into pieces that fly apart and fade. Best for galleries and bold exits.</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">Watch it</h2><p>It plays by itself. Turn on slow motion to follow each piece as it flies.</p></div>+ </div>+ <div class="stage hb-dots">+ <div class="deck" id="deck" role="img" aria-label="A photo card breaks into pieces that fly apart while the next photo fades in">+ <div class="card on"><div class="pic night"><svg viewBox="0 0 120 100" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><g fill="#fff"><circle cx="12" cy="9" r=".8"/><circle cx="31" cy="19" r=".5"/><circle cx="53" cy="7" r=".6"/><circle cx="88" cy="11" r=".8"/><circle cx="105" cy="27" r=".5"/><circle cx="71" cy="31" r=".4"/><circle cx="19" cy="35" r=".5"/></g><path fill="#4ef0a8" opacity=".5" d="M-4 46C18 24 40 50 62 30S100 14 124 26V36C100 26 80 46 60 42S20 40-4 58Z"/><path fill="#7cd8ff" opacity=".35" d="M-4 34C24 18 44 36 66 22S104 8 124 14V20C104 16 86 32 66 32S26 30-4 44Z"/><path fill="#12305a" d="M-4 76L16 58L28 66L46 46L62 62L78 52L98 68L124 56V100H-4Z"/><path fill="#dbe8ff" opacity=".85" d="M46 46L51.6 51.1L48.6 50.4L46.2 52.4L43.8 50.6L40.9 51.4Z"/><path fill="#081830" d="M-4 88L20 70L36 80L58 62L82 82L104 70L124 82V100H-4Z"/></svg></div>+ <p class="cap"><b>Northern Lights</b><span>Photo 1 of 3</span></p><svg class="cracks" aria-hidden="true"></svg></div>+ <div class="card"><div class="pic dunes"><svg viewBox="0 0 120 100" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><circle cx="80" cy="54" r="12" fill="#ffe9b8"/><path fill="#e08345" d="M-4 72C22 60 44 62 64 70S104 64 124 66V100H-4Z"/><path fill="none" stroke="#f6b37c" stroke-width=".8" opacity=".7" d="M8 66C26 60 44 62 60 69"/><path fill="#c2602f" d="M-4 84C26 70 56 76 78 86S112 80 124 76V100H-4Z"/><path fill="#93441f" d="M-4 96C34 84 74 86 124 98V100H-4Z"/></svg></div>+ <p class="cap"><b>Desert Dunes</b><span>Photo 2 of 3</span></p><svg class="cracks" aria-hidden="true"></svg></div>+ <div class="card"><div class="pic cove"><svg viewBox="0 0 120 100" preserveAspectRatio="xMidYMid slice" aria-hidden="true"><circle cx="28" cy="24" r="9" fill="#fff6d0"/><g fill="#fff" opacity=".9"><ellipse cx="74" cy="20" rx="12" ry="4"/><ellipse cx="84" cy="17" rx="8" ry="4"/><ellipse cx="102" cy="31" rx="9" ry="3"/></g><path fill="#1c6db0" d="M-4 60H124V100H-4Z"/><path fill="none" stroke="#86c9f6" stroke-width="1" opacity=".8" d="M4 70q6-2.5 12 0t12 0M30 82q6-2.5 12 0t12 0M8 92q6-2.5 12 0t12 0M56 70q6-2.5 12 0"/><path fill="#fff" d="M36 70V54L48 70Z"/><path fill="#5a3a26" d="M31 71H52L49 75H34Z"/><path fill="#2f7a52" d="M76 100L80 66L90 56L104 58L124 48V100Z"/><path fill="#245e40" d="M96 100L100 70L112 62L124 64V100Z"/></svg></div>+ <p class="cap"><b>Ocean Cove</b><span>Photo 3 of 3</span></p><svg class="cracks" aria-hidden="true"></svg></div>+ <i class="flash"></i>+ </div>+ </div>+ <div class="hb-player">+ <button class="hb-play" type="button" id="btn-play" data-hb-replay><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>Replay</button>+ <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="loop-tog" data-hb-loop autocomplete="off"><span>Loop</span></label>+ <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>+ </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 and the animation plays again.</p></div>+ </div>+ <div class="hb-settings">+ <div class="hb-setting">+ <p class="hb-setting-name" id="count-lbl">Number of pieces</p>+ <div class="seg" id="count-seg" role="group" aria-labelledby="count-lbl">+ <button type="button" data-n="few" aria-pressed="false">Few</button>+ <button type="button" data-n="medium" class="on" aria-pressed="true">Medium</button>+ <button type="button" data-n="many" aria-pressed="false">Many</button>+ </div>+ <p class="hb-hint">More pieces look like thinner glass; phones cut Many a little coarser.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="from-lbl">Breaks from</p>+ <div class="seg" id="from-seg" role="group" aria-labelledby="from-lbl">+ <button type="button" data-from="center" class="on" aria-pressed="true">Center</button>+ <button type="button" data-from="corner" aria-pressed="false">Corner</button>+ </div>+ <p class="hb-hint">The break starts there, and the nearest pieces fly first.</p>+ </div>+ <div class="hb-setting">+ <p class="hb-setting-name" id="grav-lbl">Gravity</p>+ <div class="seg" id="grav-seg" role="group" aria-labelledby="grav-lbl">+ <button type="button" data-g="none" aria-pressed="false">None</button>+ <button type="button" data-g="normal" class="on" aria-pressed="true">Normal</button>+ <button type="button" data-g="heavy" aria-pressed="false">Heavy</button>+ </div>+ <p class="hb-hint">With none, the pieces drift away instead of falling.</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="speed-lbl">Speed</p>+ <div class="seg" id="speed-seg" role="group" aria-labelledby="speed-lbl">+ <button type="button" data-ms="1700" aria-pressed="false">Slow</button>+ <button type="button" data-ms="1100" class="on" aria-pressed="true">Normal</button>+ <button type="button" data-ms="700" aria-pressed="false">Fast</button>+ </div>+ <p class="hb-hint">How long the pieces take to fly and fade.</p>+ </div>+ <div class="hb-setting">+ <label class="hb-switch-row"><span>Shows the cracks</span><input class="hb-switch" type="checkbox" role="switch" id="cracks-tog" checked autocomplete="off"></label>+ <p class="hb-hint">Cracks spread across the card a moment before it breaks.</p>+ </div>+ <div class="hb-setting">+ <label class="hb-switch-row"><span>Tumbles in 3D</span><input class="hb-switch" type="checkbox" role="switch" id="tumble-tog" checked autocomplete="off"></label>+ <p class="hb-hint">The pieces flip toward you instead of spinning flat.</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 shatter effect to [the card or picture you want to break]. When it plays, the card breaks into uneven pieces that burst away from the point of impact, each turning as it flies and fading out, while the next card fades in behind them. Make each piece a copy of the whole card trimmed to its own shape, so together they look exactly like the card until they move, and launch the pieces nearest the impact first. Move and turn the pieces rather than resizing them so it stays smooth, and remove them once they have faded. If the visitor has reduced motion turned on, fade the card out and the next one in, with no pieces. 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>+ </section>++ <section class="hb-about" aria-labelledby="hb-what-title">+ <div class="hb-what">+ <h2 id="hb-what-title">What it is</h2>+ <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>+ </div>+ <div class="hb-fit">+ <h2>Good for</h2>+ <ul class="hb-tags hb-good"><li>Photo galleries</li><li>Dismissed cards</li><li>Game moments</li><li>Bold intros</li></ul>+ <h3>Avoid on</h3>+ <ul class="hb-tags hb-avoid"><li>Things shown often</li><li>Calm, serious pages</li></ul>+ </div>+ </section>++ <section class="hb-related" aria-labelledby="hb-related-title" hidden>+ <h2 id="hb-related-title">Similar animations</h2>+ <div class="hb-rel-list"></div>+ </section>+</main>+<footer class="hb-foot"><span>Animation Handbook</span><a href="#top">Back to top ↑</a></footer>+<script>+ const deck=document.getElementById('deck'),cards=[...deck.querySelectorAll('.card')],flashEl=deck.querySelector('.flash');+ const [loopTog,slowTog,cracksTog,tumbleTog]=['loop-tog','slow-tog','cracks-tog','tumble-tog'].map(id=>document.getElementById(id));+ const reduce=matchMedia('(prefers-reduced-motion:reduce)'),phone=matchMedia('(max-width:600px),(max-height:500px)');+ // Rays besides the four to the corners, and the rings that cross them, for each number of pieces+ const CUTS={few:[3,2],medium:[6,3],many:[11,4]},RINGS={2:[.45,1],3:[.24,.56,1],4:[.15,.36,.64,1]};+ // One flight, in card heights: how far the pieces burst outward, how high they are thrown and how far gravity pulls them+ const PULL={none:[1.1,0,0],normal:[.75,.6,2.3],heavy:[.55,.3,4.4]};+ let pieces='medium',from='center',gravity='normal',ms=1100,cur=0,timers=[];+ const later=(fn,wait)=>timers.push(setTimeout(fn,wait)),slow=v=>slowTog.checked?v*3:v,rnd=(a,b)=>a+Math.random()*(b-a);++ // Cuts a W×H card like glass hit at one point: rays run from the point to the edge (through the four corners, so the outer+ // pieces end exactly on the edge, and spread evenly in between), rings cross them, and each crack from one ring to the next+ // bends once. A piece lies between two rays and two rings; neighbors share corners and bends, so the pieces tile the card.+ function cut(W,H){+ const TAU=2*Math.PI,p=from==='center'?[W*rnd(.45,.55),H*rnd(.36,.46)]:[W*.15,H*.13];+ const extra=pieces==='many'&&phone.matches?8:CUTS[pieces][0],f=RINGS[CUTS[pieces][1]];+ const corners=[[0,0],[W,0],[W,H],[0,H]].map(([x,y])=>(Math.atan2(y-p[1],x-p[0])+TAU)%TAU).sort((a,b)=>a-b);+ const rays=corners.flatMap((c,i)=>{const span=(corners[(i+1)%4]-c+TAU)%TAU,m=Math.round(extra*span/TAU);+ return [c,...[...Array(m)].map((_,j)=>c+span*(j+1+rnd(-.3,.3))/(m+1))]});+ const edge=a=>{const c=Math.cos(a),s=Math.sin(a);return Math.min(c>1e-9?(W-p[0])/c:c<-1e-9?-p[0]/c:1e9,s>1e-9?(H-p[1])/s:s<-1e-9?-p[1]/s:1e9)};+ const grid=[rays.map(()=>p),...f.map((k,i)=>rays.map(a=>{const r=edge(a)*(i<f.length-1?k*rnd(.88,1.12):1);return [p[0]+Math.cos(a)*r,p[1]+Math.sin(a)*r]}))];+ const bends=grid.slice(1).map((ring,i)=>ring.map((b,k)=>{const a=grid[i][k],t=rnd(.4,.6),j=rnd(-.08,.08);+ return [a[0]+(b[0]-a[0])*t-(b[1]-a[1])*j,a[1]+(b[1]-a[1])*t+(b[0]-a[0])*j]}));+ const polys=[];+ for(let i=0;i<f.length;i++)rays.forEach((_,k)=>{const n=(k+1)%rays.length;+ polys.push([grid[i][k],bends[i][k],grid[i+1][k],grid[i+1][n],bends[i][n]].concat(i?[grid[i][n]]:[]))});+ return {p,grid,bends,polys};+ }+ // The cracks, ring by ring from the break outward (the card's own edge is not a crack)+ function crackLines(card,{grid,bends},crack){+ const svg=card.querySelector('.cracks'),P=v=>v[0].toFixed(1)+' '+v[1].toFixed(1);+ svg.setAttribute('viewBox','0 0 '+card.offsetWidth+' '+card.offsetHeight);+ svg.innerHTML=bends.map((ring,i)=>{+ const d=ring.map((v,k)=>'M'+P(grid[i][k])+'L'+P(v)+'L'+P(grid[i+1][k])).join('')+(i<bends.length-1?'M'+grid[i+1].map(P).join('L')+'Z':'');+ return '<g><path class="dk" d="'+d+'"/><path class="lt" d="'+d+'"/></g>';+ }).join('');+ [...svg.children].forEach((g,i)=>g.animate([{opacity:0},{opacity:1}],{duration:crack*.3,delay:crack*.14*i,fill:'backwards'}));+ }+ // Every piece is a box around its polygon holding a copy of the whole card, clipped to the polygon (grown by 0.7px so+ // neighbors overlap and no seam shows). Its flight is sampled into keyframes: a burst away from the break that slows+ // down, an upward throw and the pull of gravity; it turns all the way and fades over the second half. It starts at the+ // break (start), and nearer pieces go first.+ function shatter(card,{p,polys},start){+ const W=card.offsetWidth,H=card.offsetHeight,X=card.offsetLeft,Y=card.offsetTop,T=slow(ms),wave=slow(ms*.16);+ const [push,lift,grav]=PULL[gravity],tumble=tumbleTog.checked,layer=document.createElement('div');+ const mid=polys.map(q=>q.reduce((m,v)=>[m[0]+v[0]/q.length,m[1]+v[1]/q.length],[0,0]));+ const far=Math.max(...mid.map(c=>Math.hypot(c[0]-p[0],c[1]-p[1])));+ layer.className='shards';+ polys.forEach((q,i)=>{+ const c=mid[i],pts=q.map(([x,y])=>{const l=Math.hypot(x-c[0],y-c[1])||1;return [x+(x-c[0])/l*.7,y+(y-c[1])/l*.7]});+ const xs=pts.map(v=>v[0]),ys=pts.map(v=>v[1]),bx=Math.floor(Math.min(...xs)),by=Math.floor(Math.min(...ys));+ const el=document.createElement('div'),copy=card.cloneNode(true);+ el.className='shard';+ el.style.cssText='left:'+(X+bx)+'px;top:'+(Y+by)+'px;width:'+(Math.ceil(Math.max(...xs))-bx)+'px;height:'+(Math.ceil(Math.max(...ys))-by)+'px;'++ 'transform-origin:'+(c[0]-bx)+'px '+(c[1]-by)+'px;clip-path:polygon('+pts.map(([x,y])=>(x-bx).toFixed(1)+'px '+(y-by).toFixed(1)+'px')+')';+ copy.style.cssText='left:'+(-bx)+'px;top:'+(-by)+'px;width:'+W+'px;height:'+H+'px';+ el.appendChild(copy);layer.appendChild(el);+ const d=Math.hypot(c[0]-p[0],c[1]-p[1]),a=Math.atan2(c[1]-p[1],c[0]-p[0])+rnd(-.35,.35);+ const v=H*push*rnd(.6,1.15)*(1.2-.45*d/far),vx=Math.cos(a)*v,vy=Math.sin(a)*v-H*lift*rnd(.6,1.2),g=H*grav;+ const vz=tumble?H*rnd(.1,.7):0,spin=[rnd(-420,420),rnd(-420,420),(Math.random()<.5?-1:1)*rnd(90,320)],frames=[];+ for(let k=0;k<=12;k++){+ const u=k/12,e=1-Math.pow(1-u,1.7),x=vx*e,y=vy*e+g*u*u/2;+ frames.push({opacity:u<.5?1:1-Math.pow((u-.5)*2,1.5),transform:tumble+ ?'translate3d('+x+'px,'+y+'px,'+vz*e+'px) rotateX('+spin[0]*u+'deg) rotateY('+spin[1]*u+'deg) rotate('+spin[2]*u+'deg)'+ :'translate('+x+'px,'+y+'px) rotate('+spin[2]*u+'deg)'});+ }+ el.animate(frames,{duration:T,delay:start+wave*d/far,fill:'both'});+ });+ deck.appendChild(layer);+ }+ // Puts every card back at rest: the pieces, cracks and running animations go, and only the card on show is visible.+ function reset(){+ timers.forEach(clearTimeout);timers=[];+ deck.getAnimations({subtree:true}).forEach(a=>a.cancel());+ deck.querySelectorAll('.shards').forEach(n=>n.remove());+ cards.forEach((c,i)=>{c.classList.toggle('on',i===cur);c.style.zIndex='';c.querySelector('.cracks').textContent=''});+ }+ // One play: a flash where it is hit, the cracks, then the card breaks and flies apart while the next card fades in behind+ // the pieces. Under reduced motion the next card fades in over it instead. While Loop is on the next card holds, then+ // breaks in turn. Slow motion stretches the play, not the hold. Replay or a setting change starts it over.+ function play(){+ reset();+ const old=cards[cur],next=(cur+1)%cards.length,card=cards[next];+ deck.insertBefore(card,flashEl);card.classList.add('on'); // the next card goes on top of the others+ if(reduce.matches)card.animate([{opacity:0},{opacity:1}],{duration:500});+ else{+ const T=slow(ms),crack=cracksTog.checked?slow(ms*.32):0,plan=cut(old.offsetWidth,old.offsetHeight);+ flashEl.style.left=old.offsetLeft+plan.p[0]+'px';flashEl.style.top=old.offsetTop+plan.p[1]+'px';+ flashEl.animate([{opacity:0,transform:'scale(.25)'},{opacity:.85,offset:.18},{opacity:0,transform:'scale(1.5)'}],{duration:Math.max(crack,slow(260)),easing:'ease-out'});+ if(crack){crackLines(old,plan,crack);old.animate([{transform:'none'},{transform:'scale(.97)',offset:.2},{transform:'none'}],{duration:crack*.7,easing:'ease-out'})}+ // The pieces are built now, before anything moves (the costly part), and wait under the card. The card goes at the+ // break by an animation too, so it keeps time with the pieces however long the first frame takes.+ shatter(old,plan,crack);old.style.zIndex=2;+ old.animate([{opacity:0},{opacity:0}],{duration:0,delay:crack,fill:'forwards'});+ card.animate([{opacity:0,transform:'scale(.9)'},{opacity:1,transform:'none'}],{duration:T*.5,delay:crack+T*.45,easing:'cubic-bezier(.2,.7,.3,1)',fill:'backwards'});+ }+ // Once all of it has played, the next card is the one on show (a reset in between cancels the play, and this with it)+ Promise.all(deck.getAnimations({subtree:true}).map(a=>a.finished)).then(()=>settle(next),()=>{});+ }+ function settle(i){cur=i;reset();if(loopTog.checked&&!reduce.matches)later(()=>{if(loopTog.checked)play()},1000)}++ document.getElementById('btn-play').addEventListener('click',play);+ loopTog.addEventListener('change',()=>{if(loopTog.checked)play()});+ 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);+ }));+ }+ choices('count-seg',d=>{pieces=d.n});choices('from-seg',d=>{from=d.from});+ choices('grav-seg',d=>{gravity=d.g});choices('speed-seg',d=>{ms=+d.ms});+</script>+</body>+</html>diff --git a/animations/03-page-transitions/dissolve/README.md b/animations/03-page-transitions/dissolve/README.mdindex 59ef1763..3dafa909 100644--- a/animations/03-page-transitions/dissolve/README.md+++ b/animations/03-page-transitions/dissolve/README.md@@ -54,3 +54,4 @@ Each tile's inline style bakes the normalized delay into a real transition: `tra- [Flash / Light Leak Transition](../flash-transition/) — a burst of light hides the change- [Blur Transition](../blur-transition/) — a blur hides the change- [Slide Transition](../slide-transition/) — pages move instead of dissolving+- [Shatter Effect](../../02-entrance-and-exit/shatter-effect/) — a card breaks into pieces that fly apart and fadediff --git a/docs/launch-kit.md b/docs/launch-kit.mdindex dda098f3..0b3cd1ea 100644--- a/docs/launch-kit.md+++ b/docs/launch-kit.md@@ -10,7 +10,7 @@ quality is already there; this is the distribution layer. Work top to bottom.GitHub → repo **Settings** (or the ⚙️ next to "About" on the repo home page):**Description:**-> 158 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.+> 159 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.**Website:** `https://matinmonshizadeh.github.io/animation-handbook/`@@ -25,7 +25,7 @@ With the GitHub CLI (`gh`), this is one command:```bashgh repo edit matinmonshizadeh/animation-handbook \- --description "158 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step." \+ --description "159 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step." \--homepage "https://matinmonshizadeh.github.io/animation-handbook/" \--add-topic web-animation,css-animation,animation,frontend,web-development,javascript,motion-design,ui-animation,scroll-animation,microinteractions,webgl,ai-prompts,reference,no-dependencies,github-pages \--remove-topic awesome@@ -41,7 +41,7 @@ and share, which drives return visits.## 2. Verify SEO is live (after pushing)-- `https://matinmonshizadeh.github.io/animation-handbook/sitemap.xml` → should list 159 URLs+- `https://matinmonshizadeh.github.io/animation-handbook/sitemap.xml` → should list 160 URLs- `https://matinmonshizadeh.github.io/animation-handbook/robots.txt` → should load- Submit the sitemap to **Google Search Console** (add the property, then Sitemaps → submit `sitemap.xml`).- Test the social card at https://opengraph.xyz — paste the homepage URL, confirm the og-image shows.@@ -59,14 +59,14 @@ comments yourself in the first hours.### Show HN (news.ycombinator.com/submit)**Title:**-> Show HN: Animation Handbook – 158 web animations, each with a prompt for your AI+> Show HN: Animation Handbook – 159 web animations, each with a prompt for your AI**URL:** `https://matinmonshizadeh.github.io/animation-handbook/`**First comment (post immediately after submitting):**> I kept re-googling the same animation techniques and landing on either a> library's marketing page or a CodePen with no explanation. So I built a-> reference: 158 techniques, from scroll effects and page transitions to+> reference: 159 techniques, from scroll effects and page transitions to> micro-interactions, text, 3D, and ambient backgrounds. You find one by where it> goes on your page (buttons, text, backgrounds, page changes…) or by describing> it. Each one plays live, has a few plain settings, and gives you a ready-made@@ -78,10 +78,10 @@ comments yourself in the first hours.### Reddit — r/webdev (Showoff Saturday) and r/Frontend**Title:**-> I built a handbook of 158 web animations — watch each one live, tweak it, and copy a prompt for your AI assistant+> I built a handbook of 159 web animations — watch each one live, tweak it, and copy a prompt for your AI assistant**Body:**-> 158 techniques in 7 categories (scroll, entrance/exit, page transitions,+> 159 techniques in 7 categories (scroll, entrance/exit, page transitions,> micro-interactions, text, 3D, ambient). Find one by where it goes on your page or> by describing it, try a few plain settings, then copy a prompt that describes it in> plain words for ChatGPT, Claude or Cursor. Each technique is also one standalone@@ -93,7 +93,7 @@ comments yourself in the first hours.### dev.to / Hashnode article-**Title:** `158 web animations you can copy as a prompt for your AI assistant`+**Title:** `159 web animations you can copy as a prompt for your AI assistant`**Outline:**1. The problem — animation knowledge is scattered across libraries and CodePens, and an AI@@ -108,7 +108,7 @@ comments yourself in the first hours.### X / Bluesky thread-> 1/ I built Animation Handbook — 158 web animations you can watch live, tweak, and+> 1/ I built Animation Handbook — 159 web animations you can watch live, tweak, and> copy as a prompt for your AI assistant. No dependencies, no build step. 🧵 <docs/demo.gif>>> 2/ Find one by where it goes — buttons, text, backgrounds, page changes — or just@@ -126,7 +126,7 @@ awesome-web-animation) via PR.### Product Hunt-**Tagline:** `158 web animations, each with a prompt for your AI assistant`+**Tagline:** `159 web animations, each with a prompt for your AI assistant`Schedule for a Tuesday–Thursday 12:01am PT. Line up 5–10 people to comment/upvote early.---diff --git a/index.html b/index.htmlindex f247bf7a..5739fcc6 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 — 158 Web Animation Techniques with Live Demos</title>-<meta name="description" content="A visual reference of 158 web animation techniques — scroll effects, page transitions, micro-interactions, text animation, 3D, and ambient backgrounds. Every entry is a live, dependency-free demo with an explanation of how it works.">+<title>Animation Handbook — 159 Web Animation Techniques with Live Demos</title>+<meta name="description" content="A visual reference of 159 web animation techniques — scroll effects, page transitions, micro-interactions, text animation, 3D, and ambient backgrounds. Every entry is a live, dependency-free demo with an explanation of how it works."><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="matinmonshizadeh"><meta name="robots" content="index, follow, max-image-preview:large">@@ -18,8 +18,8 @@<!-- Open Graph --><meta property="og:type" content="website"><meta property="og:site_name" content="Animation Handbook">-<meta property="og:title" content="Animation Handbook — 158 Web Animation Techniques with Live Demos">-<meta property="og:description" content="A visual reference of 158 web animation techniques. Every entry is a live, dependency-free demo with an explanation of how it works.">+<meta property="og:title" content="Animation Handbook — 159 Web Animation Techniques with Live Demos">+<meta property="og:description" content="A visual reference of 159 web animation techniques. Every entry is a live, dependency-free demo with an explanation of how it works."><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">@@ -27,8 +27,8 @@<!-- Twitter --><meta name="twitter:card" content="summary_large_image">-<meta name="twitter:title" content="Animation Handbook — 158 Web Animation Techniques">-<meta name="twitter:description" content="A visual reference of 158 web animation techniques. Every entry is a live, dependency-free demo you can open in the browser.">+<meta name="twitter:title" content="Animation Handbook — 159 Web Animation Techniques">+<meta name="twitter:description" content="A visual reference of 159 web animation techniques. Every entry is a live, dependency-free demo you can open in the browser."><meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png"><!-- Structured data: parsed by search + AI answer engines -->@@ -38,7 +38,7 @@"@type": "WebSite","name": "Animation Handbook","url": "https://matinmonshizadeh.github.io/animation-handbook/",- "description": "A visual reference of 158 web animation techniques, each with a live, dependency-free demo and an explanation of how it works.",+ "description": "A visual reference of 159 web animation techniques, each with a live, dependency-free demo and an explanation of how it works.","inLanguage": "en","author": { "@type": "Person", "name": "matinmonshizadeh" },"about": ["web animation", "CSS animation", "motion design", "frontend development"],@@ -585,6 +585,24 @@ button,input{font:inherit;color:inherit}.pv-rotatein .gear{width:32%;aspect-ratio:1;border-radius:7px;border:2px solid var(--accent);background:color-mix(in srgb,var(--accent) 12%,transparent);animation:e-rotatein 3s var(--ease) infinite}@keyframes e-rotatein{0%{transform:rotate(-180deg) scale(.3);opacity:0}35%,72%{transform:rotate(0) scale(1);opacity:1}100%{transform:rotate(180deg) scale(.3);opacity:0}}+/* a card cut into eight pieces (each a copy of the card clipped to a triangle from the impact point) cracks, flies apart and+ fades while the next card fades in as one (its set, so no seams show); the two sets take turns half a cycle apart, and the+ flying set is on top; mid-burst at 15% (STILL) */+.pv-shatter{background:#08090c;display:grid;place-items:center;container-type:size}+.pv-shatter .cd{position:relative;height:62cqh;aspect-ratio:4/5;transform:translateY(9cqh)} /* below the place label */+.pv-shatter .set{position:absolute;inset:0;animation:e-shset 6s linear infinite}+.pv-shatter i{position:absolute;inset:0;border-radius:9%/7%;animation:e-shatter 6s linear infinite}+.pv-shatter .sb,.pv-shatter .sb i{animation-delay:-3s}+.pv-shatter .sa i{background:linear-gradient(#16171b 0 0) 18% 88%/50% 5% no-repeat,linear-gradient(#f4f1ea 0 0) 0 100%/100% 25% no-repeat,radial-gradient(circle at 66% 38%,#ffe9b8 0 13%,#0000 13.5%),linear-gradient(#3a1d5c,#b8476f 38%,#f39a5e 60%,#c2602f 60.5%)}+.pv-shatter .sb i{background:linear-gradient(#16171b 0 0) 18% 88%/50% 5% no-repeat,linear-gradient(#f4f1ea 0 0) 0 100%/100% 25% no-repeat,conic-gradient(from 135deg at 42% 44%,#081830 90deg,#0000 0),radial-gradient(80% 24% at 50% 24%,rgba(78,240,168,.6),#0000 70%),linear-gradient(#06112b,#16507a)}+@keyframes e-shset{0%,36%{opacity:1;transform:none;z-index:2}37%,62%{opacity:0;transform:translateY(5%);z-index:1}74%,100%{opacity:1;transform:none;z-index:1}}+@keyframes e-shatter{0%{transform:none;opacity:1}3%,6%{transform:translate(calc(var(--x)*3%),calc(var(--y)*3%)) rotate(0deg);opacity:1}+ 12%{transform:translate(calc(var(--x)*17%),calc(var(--y)*12% - 2.4%)) rotate(calc(var(--r)*.2))}+ 18%{transform:translate(calc(var(--x)*31%),calc(var(--y)*21% + 6.4%)) rotate(calc(var(--r)*.4));opacity:1}+ 24%{transform:translate(calc(var(--x)*45%),calc(var(--y)*30% + 26.4%)) rotate(calc(var(--r)*.6));opacity:.8}+ 30%{transform:translate(calc(var(--x)*59%),calc(var(--y)*39% + 57.6%)) rotate(calc(var(--r)*.8));opacity:.4}+ 36%{transform:translate(calc(var(--x)*73%),calc(var(--y)*48% + 100%)) rotate(var(--r));opacity:0}37%,100%{transform:none;opacity:1}}+/* ── bespoke: 03 Page Transitions ── */.pv-vt,.pv-xfade,.pv-slidepage,.pv-zoompage{background:#08090c;position:relative;overflow:hidden}.pv-vt .pg,.pv-xfade .pg,.pv-slidepage .pg,.pv-zoompage .pg{position:absolute;inset:0;display:grid;place-items:center}@@ -1329,7 +1347,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>158 free animations · no coding needed</p>+ <p class="pill"><span class="pill-dot" aria-hidden="true"></span>159 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">@@ -1386,8 +1404,8 @@ 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 158 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div>- <noscript><p class="noscript">This page shows its animations with JavaScript. All 158 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>+ <div class="more" id="more"><button type="button" class="bigbtn" id="more-btn"><span id="more-label">Browse all 159 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div>+ <noscript><p class="noscript">This page shows its animations with JavaScript. All 159 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">@@ -1405,7 +1423,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">158 web animations with live demos and copyable prompts.</p>+ <p class="foot-t">159 web animations with live demos and copyable prompts.</p><nav class="nav" aria-label="Footer"><a class="lnk" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener noreferrer">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>@@ -1473,6 +1491,7 @@ const CATS=[['flip-in','Flip In','Swings into view in 3D, like a card turning over. Best for cards and tiles.'],['bounce-in','Bounce In','Lands with a springy bounce. Best for badges and success messages.'],['rotate-in','Rotate In','Spins into place while it grows. Best for icons, stars and badges.'],+ ['shatter-effect','Shatter Effect','Breaks into pieces that fly apart and fade. Best for galleries and bold exits.'],]},{@@ -1651,7 +1670,7 @@ const PV={'fade-in-out':'fade','slide-in':'slidein','slide-up-reveal':'slideup','scale-in':'scalein','clip-path-reveal':'clipreveal','curtain-reveal':'curtain','split-text-reveal':'split','letter-by-letter-stagger':'letters','word-by-word-reveal':'words','blur-in':'blurin',- 'flip-in':'flipin','bounce-in':'bouncein','rotate-in':'rotatein',+ 'flip-in':'flipin','bounce-in':'bouncein','rotate-in':'rotatein','shatter-effect':'shatter','view-transitions-api':'vt','shared-element-transition':'shared','morph-transition':'morph','crossfade':'xfade','slide-transition':'slidepage','zoom-transition':'zoompage','flash-transition':'flash','blur-transition':'blurpage','elastic-transition':'elastic','portal-zoom':'portal','dissolve':'dissolve','flip-technique':'flip',@@ -1723,6 +1742,7 @@ const PLACES={'flip-in':['intro','imgcard'],'bounce-in':['intro','load'],'rotate-in':['intro'],+ 'shatter-effect':['imgcard','page'],// 03'view-transitions-api':['page'],'shared-element-transition':['page','imgcard'],@@ -1855,6 +1875,11 @@ function pvMarkup(k){case 'sig1': return '<div class="s1 anim">'+'<b></b>'.repeat(9)+'</div>';case 'hideheader': return '<span class="win"><span class="pg anim">'+[0,100,86,100,70,0,100,92,64,100,0,78,100,88].map(function(w){return w?'<b style="width:'+w+'%"></b>':'<b class="im"></b>';}).join('')+'</span><span class="bar anim"><span class="lg"></span><span class="nm"></span><span class="mn"></span></span></span>';case 'sig2': return '<span class="s2 anim"></span>';+ case 'shatter': {const B=[[0,0],[46,0],[100,0],[100,52],[100,100],[58,100],[0,100],[0,48]],R=[-160,140,200,-120,90,-150,170,-210];+ // eight triangles from the impact point (50% 42%) to the edge, each grown 1.5% about its middle so neighbors overlap+ return '<span class="cd">'+['sa','sb'].map(s=>'<span class="set '+s+' anim">'+B.map((q,k)=>{const t=[[50,42],q,B[(k+1)%8]],c=[0,1].map(a=>t.reduce((m,v)=>m+v[a]/3,0)),l=Math.hypot(c[0]-50,c[1]-42);+ return '<i class="anim" style="clip-path:polygon('+t.map(v=>{const m=Math.hypot(v[0]-c[0],v[1]-c[1]);return (v[0]+(v[0]-c[0])/m*1.5).toFixed(1)+'% '+(v[1]+(v[1]-c[1])/m*1.5).toFixed(1)+'%';}).join()++ ');transform-origin:'+c[0].toFixed(1)+'% '+c[1].toFixed(1)+'%;--x:'+((c[0]-50)/l).toFixed(2)+';--y:'+((c[1]-42)/l).toFixed(2)+';--r:'+R[k]+'deg"></i>';}).join('')+'</span>').join('')+'</span>';}case 'sig3': return '<span class="s3 pa anim"></span><span class="s3 pb anim"></span>';case 'circlerev': return '<span class="pg"><b></b><b></b><b></b></span><span class="c anim"></span><span class="pg pb anim"><b></b><b></b><b></b></span><span class="t anim"></span>';case 'cubepage': return '<div class="sc"><span class="f a anim"><span class="pg"><b></b><b></b><b></b></span><i class="d anim"></i></span><span class="f b anim"><span class="pg"><b></b><b></b><b></b></span><i class="d anim"></i></span></div>';@@ -2178,7 +2203,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,circlerev:.25,owipe:.165,pcurl:.44,cubepage:.3,reorder:.4,ascii:.2,phys2d:.6+ flash:.41,blurpage:.2,toggle:.7,shake:.8,hideheader:.72,hilite:.7,splitflap:.7,handwrite:.75,circlerev:.25,owipe:.165,pcurl:.44,cubepage:.3,reorder:.4,ascii:.2,phys2d:.6,shatter:.15};function hold(card){const anims=card.querySelector('.pv').getAnimations({subtree:true});diff --git a/sitemap.xml b/sitemap.xmlindex 38230db2..e847de1b 100644--- a/sitemap.xml+++ b/sitemap.xml@@ -41,6 +41,7 @@<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/flip-in/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/bounce-in/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/rotate-in/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/shatter-effect/</loc><lastmod>2026-10-01</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/view-transitions-api/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/shared-element-transition/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/03-page-transitions/morph-transition/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>