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.
Animation Handbook — Claude Code Instructions
Project purpose
A visual reference of web animation techniques. Each animation has its own folder with a self-contained HTML demo and a short README explaining the mechanics. Goal: help people understand what each animation type is by seeing it work and reading why it works. Each page also gives a plain-words prompt to paste into an AI assistant, so the site itself shows no code.
Hard rules
- One animation = one folder under
animations/<category>/<slug>/. - Each folder contains exactly:
index.html,README.md, optionallypreview.giforpreview.png. - No build step. No frameworks. No npm packages. Plain HTML + CSS + vanilla JS only. The animation itself (its markup, styles and script) lives in one HTML file; the page around it comes from two shared files (below).
- No external dependencies in demos. No CDN GSAP, no jQuery. If a
technique requires a library in production, mention that in the README
but demonstrate the principle with vanilla code. A page loads only files
from this repository: the two shared files, the site font, the site icons
and its own
README.md(fetched for What it is and Similar animations). - Keep demos under ~300 lines total. If it's longer, the explanation has failed.
- Demos must work offline. Open the HTML in a browser, it runs (from a checkout of the repository, which holds the shared files the page links).
- The site is the repository as it is. The root has
.nojekyll, so GitHub Pages serves every file as it is, with no Jekyll pages built from the Markdown. GitHub Pages shows the root404.htmlat every missing address, at any depth, so every address in it starts with/animation-handbook/.
File template for each animation
index.html structure
A page is one HTML file: the demo's own CSS in a <style> and JS in a <script>, inside the shared
guided-steps page. Copy the closest page of the same kind and change the demo, its settings and its
texts; the tests pin the Pause, Show me, Reset, Play and Back to top buttons character by character.
Starting points: rotate-in (plays once), aurora (loop in CSS), starfield (loop in JavaScript),
checkmark-draw (do it), snap-scrolling (scroll). The <head> has the title Name — Animation Handbook,
the canonical URL, the favicons, and the Open Graph, Twitter and JSON-LD tags that repeat the name and
description: copy them from a neighbor page and change them together.
Shared files. Every page links these after its own <style>, with one version N on every page.
When either file changes, bump N on every page in the same change, or visitors keep a cached copy (a
test fails if the pages differ). demo-page.css draws the page around the demo; demo-page.js runs it.
The home page links demo-page.js too (its cards' Copy prompt builds the text with
DemoPage.pageCopyText), with the same N.
<link rel="stylesheet" href="../../../assets/css/demo-page.css?v=N">
<script src="../../../assets/js/demo-page.js?v=N" defer></script>
The page (one centered column at every size; each part appears once):
- Top bar (
nav.hb-bar): the home link, Previous / Next links to the neighbors in the category (rel="prev",rel="next"; the first and last page have one) and, last, the Star on GitHub link (a.hb-star). - Header (
header.hb-head): the category lineNN.MM · Category(its place in the home page's All animations list), the<h1>and the one-line description (p.hb-lede) in plain words, ending "Best for …". That sentence is also the meta, Open Graph, Twitter and JSON-LD description, its card in theCATSarray of the rootindex.html, and its line in both READMEs. - 1 · Watch it (
section.hb-watch): help line, stage (div.stage), player bar (div.hb-player); the step title and help line are written per page. - 2 · Try it (
section.hb-try): one to three settings, the rest under More options (details.hb-options). No settings: leave it out and number the steps 1 and 2. - 3 · Copy the prompt (
section.hb-prompt-step): prompt (p.hb-prompt), "Your settings" chips, Copy prompt; under the card, the star row (div.hb-star-row: a sentence and a Star on GitHub button). The star ask: after the first copy that works, the shared script marks the rowis-askedand the button's edge and star turn gold, with one small pulse where motion is welcome; nothing scrolls or takes focus. - About (
section.hb-about): What it is (from the README) beside Good for (3–5 tags) and Avoid on (1–3 tags); then Similar animations (section.hb-related) and the footer, the same on every page (copy it from a neighbor):
<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>
The Star link and the star row are the same on every page too: copy them from a neighbor (a test compares them).
The page owns the stage's width, border, corners and height (--hb-stage-h and --hb-stage-h-phone set
another one); the demo owns overflow, background, alignment and perspective. hb-dots adds a dotted
background to a plain dark stage; hb-grow lets a stage with visitor-editable text grow taller.
Mode switch (optional, on some pages). In the Watch step, between the heading and the stage, div.seg.hb-modes[data-hb-modes]
holds three buttons with data-hb-mode: normal (pressed at first), inside (See inside) and compare. After the player bar,
div.hb-mode-notes[aria-live=polite] holds exactly two hidden notes, direct children and one or two sentences each:
p[data-hb-for="inside"] then p[data-hb-for="compare"] (the Compare note names the halves by their labels). A press marks the
stage data-hb-mode, shows that mode's note and then sends hb:mode on document (detail.mode; again on a press of the mode
already pressed, never at boot). The demo listens at the top level of its script, draws the mode at once and never scrolls, moves
focus, presses a control, stops Play or changes Pause; every mode rule names .stage[data-hb-mode="inside"] or "compare" (Normal
has none) and labels carry data-hb-caption. Ruling 1: after See inside or Compare the shared script presses Replay (once pages)
or Show me (do pages) one time so the view is seen working; never under reduced motion, after Normal, or on a scroll or loop page.
The mode is not a setting: it stays out of Your settings and the prompt. Copy fade-in-out (once), magnetic-button (do),
parallax-scrolling (scroll) or marquee-ticker (loop).
Page kinds and their controls
The body declares one kind: <body class="hb" data-hb-kind="once|loop|do|scroll">. Every kind except loop also
has data-hb-autoplay on the body, which runs the arrival. Player markers sit in the player bar, at most one
of each, and the Loop and Slow motion switches start unchecked.
| Kind | Step 1 | Player bar | On arrival |
|---|---|---|---|
| once (plays once) | Watch it | Replay data-hb-replay, Loop switch data-hb-loop, Slow motion switch data-hb-slowmo |
Loop switches on after about 400 ms, so the demo plays and repeats |
| loop (moves by itself) | Watch it | Pause/Play data-hb-pause, Slow motion where it works, sometimes Reset data-hb-reset |
Nothing: it is already moving |
| do (the visitor acts) | Hover it, Click it, Drag it, Scroll it or Press Tab | Show me data-hb-demo, Reset where there is a state to reset, Slow motion where it works |
Show me is pressed once, unless the visitor got there first |
| scroll (driven by scroll position) | Scroll it | Play data-hb-autoscroll, Back to top data-hb-top |
Play is pressed once: the box scrolls to its end in about six seconds |
data-hb-replayplays from the start (and keeps looping if Loop is on);data-hb-looprepeats while checked;data-hb-resetreturns the demo to its start.data-hb-slowmo: three times slower. With the valuecssthe script slows every CSS animation and transition in the stage (later ones too); with no value the demo slows itself (its durations and timers, not the pauses).data-hb-pause: with the valuecssthe script holds the stage's CSS animations (classhb-paused); with no value the demo pauses itself. Either wayhb:pauseis sent ondocument(detail.paused). A demo with its own timers registers that listener at the top level of its script, not in aDOMContentLoadedhandler: under reduced motion the event is sent once at boot, beforeDOMContentLoaded.data-hb-demo: plays one example (two to four seconds) and returns to rest. A real press, key, wheel, touch or click in the stage is sent ashb:inputondocument(detail.type), so the page can stop a run. The press on arrival is skipped when the visitor has already acted (a real input or focus in the stage, or their own press of Show me), so a do-it page never moves focus into its stage while it loads: its ownfocus()counts as the visitor's.data-hb-autoscroll: scrolls the scroller to its end at a steady speed (the whole box in about six seconds; it restarts from the top if already at the end, with CSS snapping off while it runs) until the visitor's own input in the stage stops it;data-hb-topstops it and jumps to the top;data-hb-scrollermarks the scroller when it is not the stage.data-hb-motion-note(scroll pages only): on the body, afterdata-hb-autoplay, one sentence with no full stop, for a page where reduced motion switches an effect off instead of only stopping its animation ("The layers stay still while the box scrolls"). The player bar shows it under reduced motion, followed by " because your device is set to reduce motion.", in place of the usual "The effects follow the scroll without animating".
A setting change replays a plays-once demo about 250 ms later; on other kinds it shows while the demo runs or at the next Show me, Play or interaction. Three owner rulings hold on every page: Pause freezes the stage at once (running transitions and timers stop mid-way); every setting and control visibly changes the stage; after Back to top or any jump, a scroll page shows the state for the new position at once.
Reduced motion
When the device asks for reduced motion, Loop and Slow motion are switched off and grayed out (they cannot be switched on) with a short note in the player bar, and loops start paused. Nothing is pressed for the visitor on arrival, except that a plays-once page plays its reduced version once so the stage is not empty. Replay, Pause/Play, Show me and Play still work when pressed. The demo itself shows the end state or a fade, not movement.
Try it
Show one to three settings (two or three is usual); the rest go under More options. Each has a plain label that
says what changes ("How much it spins", never "Rotation (deg)" or a CSS name), the control and one hint line;
every field has autocomplete="off". Prefer named choices ("Slow · Normal · Fast") to numbers, switches for
on/off ("Grows from small") and a slider only when sliding is the point (it shows its value in plain words).
Playback is not a setting, and Try it shows no status lines or code values.
Write each control one way. Choice buttons: div.seg[role=group] with aria-pressed, exactly one pressed.
Switch: label.hb-switch-row around input.hb-switch[role=switch]. Colors: div.swatches buttons with the
color name as aria-label. Text: label.hb-setting-name[for] with input.hb-text or textarea.hb-text. Copy
these from a page that has one. No page has a slider (input[type=range] with an output.hb-value) or a
menu (select.hb-select) yet: follow the controls table in
docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md. "Your settings" lists every control as
label: value, except a hidden one or one with data-hb-skip (controls under a closed More options count);
data-hb-label overrides a label. A setting whose default is lower on phones marks the choice button of its phone
default with data-hb-phone; the page and the home page's Copy prompt both read it.
The copyable prompt
Written in the page (p.hb-prompt) in plain words: 60 to 130 words, never more, no code, no backticks. It
starts with what to build and where ("Add a … to [the element you want to animate]"), with [square brackets]
around what the reader fills in. It says what the viewer sees, the one or two rules that make it look right,
how to keep it smooth, what to do under reduced motion and the touch equivalent of a hover or drag; it stays
neutral about tools and never states a value that a setting controls. It ends with "Match the settings
listed below." when the page has a Try it step, and a page without settings does not say it.
Colors and font
The demo's own styles use CSS variables for colors and default to a dark stage with light cards. Each page
sets --ui-accent in :root to its category's color (copy it from another page in the category); the shared
stylesheet uses it for step numbers, chips and pressed buttons. The site font is Schibsted Grotesk
(assets/fonts/, loaded by demo-page.css); stage text uses it and a demo sets no other family. A
typewriter (monospace) font is only for effects about typing.
README.md structure
Every animation README has exactly these sections:
- What it is — 2-3 sentence definition
- When to use it — bullets of real use cases
- How it works — the mechanic, with code snippet
- Key parameters — the values that matter (delay, threshold, etc.)
- Production notes — gotchas, library equivalents (GSAP, Framer Motion)
- See also — links to related animations in the handbook
The tests require What it is, When to use it, Key parameters and See also; the other two are required by
convention. The page loads What it is and See also from the README; What it is and Key parameters
contain no code. Each See also line is - [Title](../slug/) — one plain phrase, Title being the linked
page's <h1>. Key parameters is a | Parameter | Default | Effect | table with one row per setting in Try it, named as
on the page (a page without Try it lists the technique's own values), no empty cell, and each choice's demo value in
plain words in Effect ("slow is 500ms, normal 300ms and fast 180ms"). How it works matches the demo's code. Opened from disk (file://), the pages
still link to each other (the shared script points folder links at index.html), but What it is and Similar
animations need a server: a page shows a README link in place of What it is and hides Similar animations.
Taxonomy (do not invent new top-level categories without asking)
- Scroll-Based — scroll-driven techniques (folder: 01-scroll-based)
- Entrance & Exit — element enter, exit, reveal animations (folder: 02-entrance-and-exit)
- Page Transitions — full-page/route transitions (folder: 03-page-transitions)
- Micro-Interactions — hover, click, focus, loading, UI feedback (folder: 04-micro-interactions)
- Text & Typography — text-specific animations (folder: 05-text-typography)
- 3D & Advanced — WebGL, shaders, particles, 3D transforms (folder: 06-3d-advanced)
- Ambient & Background — passive looping effects (folder: 07-ambient-background)
The home page calls them groups and shows the seven as chips under Good places to start (All, then one chip a group, written
in the page's markup in CATS order; a test compares them). A chip shows its group's cards, and the address is ?cat= and
the group's name as a slug (?cat=micro-interactions).
Distinction: technique vs tool
This handbook catalogs techniques, not libraries. GSAP, Framer Motion, Lottie, Three.js are tools that implement techniques. They get mentioned inside an entry's "Production notes" section, never as their own entry.
Writing style
- Prose explanations, not bullet-soup.
- Show, then explain. The demo is the main artifact; words support it.
- Avoid hype. No "stunning", "amazing", "powerful". Describe what it does.
- Code comments only when the code isn't self-explanatory.
- On the pages, write for someone new to animation: plain labels, hints, descriptions and prompts, with no code and no CSS property names.
- Use American spelling (color, behavior, center, neighbor, gray).
When asked to add a new animation
- Confirm the category, the slug and the page kind (plays once, loops, do it, scroll).
- Create the folder under
animations/<category>/<slug>/. - Create
index.htmlby copying the closest page of the same kind and following the template above. - Create
README.mdwith all 6 required sections. - Link it in: the page before it gets a Next link to it and the page after it a Previous link to it, each
replacing its old one, if any (a page never has two
rel="next"or tworel="prev"links); the new page links back to both. A new first or last page has one neighbor, so one link. The link text andaria-labeluse the linked page's<h1>; copy the markup from a neighbor. Adding a page mid-category renumbers theNN.MMcategory line of every later page. - Update the root
index.htmlindex page to link to it: add a card to the category'sentriesin theCATSarray (slug, name, the page's one-line description);sitemap.xmland the home page's plain list of links (in its<noscript>, for visitors and crawlers without JavaScript) are written fromCATS(step 8). Give it one or more places inPLACES(right afterPVin the same script):btnButtons,textText,imgcardImages & cards,bgBackgrounds,menuMenus & forms,loadLoading & messages,introPage intros,scrollScrolling,pagePage changes; the first one labels its card. KeepPLACESin the same order asCATS(a test checks it). Give the card its own preview too: its key inPV, its CSS at the end of the category's/* ── bespoke: … ── */block (light: CSS with transform and opacity, no new canvas engine, inside its 16:10 stage), its markup as acaseinpvMarkup(), and aSTILLpoint when the middle of its loop is not a clear frame (reduced motion holds every preview there). Without one the card shows the category's generic picture. Give it its finder answers inFINDtoo, a row right afterPLACESinCATSorder:'slug':['what','when','how'], each a space-separated list of answer keys fromFIND_Q, the main one first. What takes 1–3 (the main one is what the demo moves), When 1–3 (every trigger the effect is commonly used with, the most common first) and How 1–4 (the most visible movement first, then the ones a visitor might name instead). Tag what a visitor sees and would say, not how it is built; a page transition answersnewpage, a loop pageloop, a Scroll-Based or scroll pagescroll.tests/finder.test.jschecks the row and runs the finder's test set. Give it extra search words inWORDStoo, a row right afterFINDinCATSorder, when a visitor would type a word that its name, places and description do not say: another everyday name for the effect (lightbox, snackbar), the part of a page it is (navbar, tabs), a code library people name the technique by (aos) or a common misspelling:'slug':'word word', lowercase single words. Only words that truly mean the card, never the name of a company or of something it sells; a card that needs none is left out. An extra word counts only when all of it is typed, or all but its ending, so it cannot take over a search for a shorter word. A word used by many cards belongs in aSAMEgroup instead (words that mean the same, as word starts).tests/pages.test.jschecks the rows; when the new card is one of the things that test lists as finding nothing (dock, chart, checkbox), take it out there. - Update
animations/<category>/README.md(its list of pages, and any other table there that names pages, such as 07's Implementation summary) and the rootREADME.mdcatalog (the card's name, linked to its live pagehttps://matinmonshizadeh.github.io/animation-handbook/animations/<category>/<slug>/, and its one-line description, in home page order); the page's own README has[Live demo](<that address>)on the line under its title. Update the technique count wherever it is written: the rootREADME.md(the total and the category's count), the home page (its title and meta tags too),.github/ISSUE_TEMPLATE/config.ymland404.html(its Browse all link); the tests compare each withCATS. The pictureog-image.pngshows the count in the home page's pill: with the repo served, runnode tools/make-social-image.mjs --base http://127.0.0.1:<port>, which draws it again from the home page. The home check needs no edit: it reads its totals fromCATSandPLACES. - Run
node tools/update-sitemap.mjs: it writes every card intositemap.xml, dated by the last commit to its folder (today for a folder with changes not yet committed), and into the home page's plain list of links (between the twoplain-linkscomment lines; a test compares the list withCATS). It writesllms.txttoo: every card under its group, for AI tools that read the site without running its scripts. Run the tests and the page check on the new folder and on every page you edited. Run the home page check (home) too: the new card's Copy prompt is compared there.
Changing anything llms.txt or the home page's plain list repeats (a card's name, line or order in CATS, or the Famous
effects page's description) also means running node tools/update-sitemap.mjs again: the tests fail until then.
Changing a preview that the Famous effects page shows (its key in PV, its case in pvMarkup(), its
rules or keyframes, its STILL point) or that page's cards means running node tools/make-famous.mjs again: the famous
test (tests/famous.test.js) fails until then.
Famous effects page
famous/index.html shows effects people admire on well-known websites as a gallery: one tile per effect, and a press opens
the whole entry in a pop-up with our version, a working demo built from the entry's own prompt
(docs/superpowers/specs/2026-10-13-famous-effects-design.md, then 2026-10-22-famous-gallery-popup-design.md, which wins).
It is one page in the home page's look and colors (a test compares them); it links neither shared file, and its own script
copies, shows the message, falls back to the copy keys and shortens prompts on phones in the animation pages' words. Its two
marked blocks, the previews' CSS and the PREVIEWS object, are written by node tools/make-famous.mjs from the home page,
never by hand.
The gallery (ul.fx-grid) holds one tile per entry in page order, then the "Seen one we should add?" tile. A tile has a
16:10 picture of our version (a light CSS loop with transform and opacity, playing only in view, a still frame under reduced
motion) tagged "Our version" and with what starts it; the entry's title as a link to #<id> stretched over the tile; one
line in our words (at most 90 characters); "Seen on ↗" (the entry's address, in a new tab) and "N animations".
The pop-up is one native <dialog class="fx-dlg">: a tile press, or arriving at famous/#<id>, moves that entry into
it (and back to its place on close), focuses its heading, loads its version and pushes #<id> (Back closes it; Previous and
Next replace it). Its bar holds Previous, Next, Close and a short not-connected note. Without JavaScript the entries read as
a plain list under the gallery (div.fx-list).
An entry is a section.fx with an id (site-what, as stripe-ribbon), data-fx-site (the site's name) and
data-fx-start (loop, load, scroll, hover or press), then, in order: "Seen on" and the site's address as a link
(https://, in a new tab, its text the address without https:// or www., its name ending "(opens in a new tab)") and
the year in a <time> whose datetime is the day it was checked; the plain title as an h2 with tabindex="-1"; the chip
row (what starts it, "Made from N animations"); the Our version block (div.fx-version: the stage with an iframe titled
"Our version: