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
docs: apply the review fixes to CONTRIBUTING.md
matin70e3727d5fcd
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex a556da44..58caf3cf 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -11,8 +11,10 @@ fix a bug, or improve an explanation are all welcome.- **No build step, no frameworks, no dependencies.** Plain HTML + CSS + vanilla JS. Theanimation itself lives in the one HTML file; the page around it comes from two sharedfiles (see [The demo page](#the-demo-page)).-- **No CDN / external requests.** If a technique needs a library in production (GSAP, Three.js),- mention it in the README's *Production notes* — but demonstrate the principle with vanilla code.+- **No CDN / external requests.** A page loads only files from this repository: the two shared+ files, the site font, the site icons and its own `README.md`. If a technique needs a library+ in production (GSAP, Three.js), mention it in the README's *Production notes* — but+ demonstrate the principle with vanilla code.- **Keep demos under ~300 lines.** If it's longer, the explanation has failed.- **Must work offline.** Open the HTML in a browser and it runs (from a checkout of therepository, which holds the shared files the page links).@@ -37,7 +39,9 @@ fix a bug, or improve an explanation are all welcome.the slug and the kind of page (see [Page kinds](#page-kinds)).2. Create `animations/<category>/<slug>/index.html`. Copy the closest existing page of thesame kind and change the demo, its settings and its texts, so the shared parts of the- page stay exactly as they are (see [The demo page](#the-demo-page)).+ page stay as they are (see [The demo page](#the-demo-page)). Good pages to copy:+ `rotate-in` (plays once), `aurora` (loop in CSS), `starfield` (loop in JavaScript),+ `checkmark-draw` (do it), `snap-scrolling` (scroll).3. Create `README.md` with **exactly** these six sections:1. **What it is** — 2–3 sentence definition2. **When to use it** — bullets of real use cases@@ -46,17 +50,24 @@ fix a bug, or improve an explanation are all welcome.5. **Production notes** — gotchas, library equivalents6. **See also** — links to related entries- The page loads *What it is* and *See also* from this file, so write them in plain words- with no code. Each *See also* line is `- [Title](../slug/) — one plain phrase`, where- Title is the linked page's `<h1>`. *Key parameters* has one row per setting in Try it,- named exactly as on the page. The other sections are for GitHub readers.-4. Register the entry in the root `index.html` `CATS` array (slug, name, one-line description)+ 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 this+ file, so write *What it is* and *Key parameters* in plain words with no code. Each *See also*+ line is `- [Title](../slug/) — one plain phrase`, where Title is the linked page's `<h1>`.+ *Key parameters* has one row per setting in Try it, named exactly as on the page.+4. Link it in: the page before it gets a Next link to it (replacing its old one), the page+ after it gets a Previous link to it, and the new page links back to both. Use the linked+ page's `<h1>` in the link text and in the `aria-label`, and copy the markup from a+ neighbor. Adding a page in the middle of a category renumbers the `NN.MM` category line of+ every later page.+5. Register the entry in the root `index.html` `CATS` array (slug, name, one-line description)and add the page to `sitemap.xml`. The description is the page's one-line description,word for word.-5. Add it to the category's `README.md` list and to the list in the root `README.md`, with- the same name and description, and update the technique count where it is written- (the root `README.md`, the home page and `tests/pages.test.js`).-6. Run the tests and the page check (see [Tests and the page check](#tests-and-the-page-check)).+6. Add it to the category's `README.md` list and to the list in the root `README.md`, with+ the same name and description, and update the technique count where it is written: the+ root `README.md`, the home page, `tests/pages.test.js` and `.github/ISSUE_TEMPLATE/config.yml`.+7. Run the tests and the page check (see [Tests and the page check](#tests-and-the-page-check))+ on the new page and on every page you edited.## The demo page@@ -85,7 +96,7 @@ Two files draw and run the page around the demo. Every page links them after its````assets/css/demo-page.css` holds the layout and the site font; `assets/js/demo-page.js` fills-in "Your settings", Copy prompt, What it is and Similar animations, and runs playing on+in the "Your settings" chips, Copy prompt, What it is and Similar animations, and runs thearrival, Pause, Slow motion, Show me, Play and reduced motion. **When either file changes,bump `N` on every page in the same change**, so visitors do not keep a cached older copy. Atest fails when the pages do not all use the same `N`.@@ -100,23 +111,30 @@ the player bar under the stage.| Kind | Step 1 | Controls | On arrival | Reduced motion ||---|---|---|---|---|-| `once`, plays once | Watch it | **Replay** (`data-hb-replay`), **Loop** (`data-hb-loop`), **Slow motion** (`data-hb-slowmo`) | Loop switches on, so it plays and repeats | Loop and Slow motion off and greyed out; Replay plays it once |-| `loop`, moves by itself | Watch it | **Pause**/Play (`data-hb-pause`), **Slow motion**, sometimes **Reset** (`data-hb-reset`) | Nothing; it is already moving | Starts paused; Slow motion off and greyed out |-| `do`, the visitor acts | Hover it, Click it, Drag it or Press Tab | **Show me** (`data-hb-demo`), **Reset** where there is a state to reset, **Slow motion** where it works | Show me runs once | Show me does not run on arrival; it works when pressed |+| `once`, plays once | Watch it | **Replay** (`data-hb-replay`), **Loop** (`data-hb-loop`), **Slow motion** (`data-hb-slowmo`) | Loop switches on, so it plays and repeats | Loop and Slow motion off and grayed out; Replay plays it once |+| `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 | Starts paused; Slow motion off and grayed out |+| `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 runs once | Show me does not run on arrival; it works when pressed || `scroll`, driven by scroll | Scroll it | **Play** (`data-hb-autoscroll`), **Back to top** (`data-hb-top`) | Play runs once: the box scrolls to its end in about six seconds | Play does not run on arrival; it works when pressed |-Put `data-hb-autoplay` on the body of every kind except `loop`. Copy the player bar from a-page of the same kind so its buttons match exactly; the tests check them. A few details:+Put `data-hb-autoplay` on the body of every kind except `loop`. The tests pin the Pause, Show+me, Reset, Play and Back to top buttons character by character, so copy the player bar from a+page of the same kind. A few details:- A do-it page's Show me run stops when the visitor uses the stage. The shared script sends`hb:input` on `document` for a real press, key, wheel, touch or click, and the demo listens.-- A loop with its own timers listens to `hb:pause` (`detail.paused`) to stop and start them.+- A demo with its own timers listens to `hb:pause` (`detail.paused`) to stop and start them.+ Register the listener at the top level of the page's script, not in a `DOMContentLoaded`+ handler: under reduced motion the shared script sends the event once at boot, before that.- `data-hb-slowmo="css"` and `data-hb-pause="css"` let the shared script slow or hold thestage's CSS animations; with no value the demo does it itself.- On a scroll page the scroller is the stage, or the element marked `data-hb-scroller`. Playscrolls it at a steady speed and any real input in the stage stops it.- `data-hb-skip` leaves a control out of "Your settings"; `data-hb-label` sets its label.+Three 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; and after Back to+top or any jump, a scroll page shows the state for the new position at once.+### SettingsGive each setting a plain label that says what changes ("How much it spins", not "Rotation@@ -125,16 +143,17 @@ numbers, switches for on/off ("Grows from small"), and a slider only when slidinpoint. Playback is not a setting; the player bar has it. Every control has a label and`autocomplete="off"`, and each group of choice buttons has exactly one pressed. The "Yoursettings" chips and the copied prompt list each setting as `label: value`. Copy the markup-from a page that uses the control you need.+from a page that uses the control you need. No page has a slider or a menu yet; for those,+follow the controls table in `docs/superpowers/specs/2026-09-27-demo-page-rollout-design.md`.### The copyable promptThe prompt is written in the page, in plain words: 60 to 130 words, never more, with no code.It starts with what to build and where ("Add a … to [the element you want to animate]"), with-the parts to fill in in [square brackets]. 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 does not state a value that a setting controls, and-it ends with "Match the settings listed below." when the page has a Try it step.+[square brackets] around the parts 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 does not state a value that a setting controls,+and it ends with "Match the settings listed below." when the page has a Try it step.### Colors@@ -150,7 +169,7 @@ about typing.### Reduced motion-When the visitor asks for reduced motion, Loop and Slow motion are shown off and greyed out+When the visitor asks for reduced motion, Loop and Slow motion are shown off and grayed outwith a short note in the player bar, and loops start paused. On arrival a plays-once pageplays its reduced version once, so the stage is not empty; Show me and Play wait to bepressed. Replay, Pause, Show me and Play still work when pressed. The demo's own CSS and@@ -182,6 +201,7 @@ Every demo must work on mobile, tablet, and desktop.## Tests and the page check+Both need Node 22 or later (the `--test` glob pattern and the page check's global `WebSocket`).Run the tests from the repo root:```@@ -193,7 +213,8 @@ rules, one description across the page, its meta tags and its home card, one `?vpage's README, the shared stylesheet and the home page. Nothing to install.For the page itself, serve the repo and run the page check on the page or a whole category-folder. It drives Chrome:+folder. It drives Chrome, found at the default Windows install path; set the `CHROME`+environment variable to the browser's path on other systems:```python -m http.server <port> --bind 127.0.0.1@@ -202,14 +223,15 @@ node tools/check-pages.mjs --base http://127.0.0.1:<port> animations/02-entranceIt opens each page at six screen setups (1280×800, 1366×657, 768×1024, 375×812, 375×812 withreduced motion, 320×640) and prints one line for each, so a passing page gives **six `ok`-lines**. A problem prints `FAIL` with the reason.+lines**. A problem prints `FAIL` with the reason. It skips controls inside `.stage` when it+measures touch targets, so check buttons and handles a demo draws there by hand.## Writing styleProse, not bullet-soup. Show, then explain. Avoid hype ("stunning", "powerful") — describewhat it does. Comment code only where it isn't self-explanatory. On the pages, write forsomeone new to animation: plain labels, hints, descriptions and prompts, with no code and no-CSS property names.+CSS property names. Use American spelling (color, behavior, center, neighbor, gray).## Fixing a bug