Skip to content

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

fix: the AI skill after review: its first rule leaves room for what a prompt asks (a blur, a clip, a color, a font weight), it covers picking, improving and no match, points to each README for values, quotes a choice that holds the separator, runs through a junction, links its files from llms.txt, and the test checks every default against the page

matincc8a92b8f583
diff --git a/llms.txt b/llms.txt
index 2fdc482c..e2ee21df 100644
--- a/llms.txt
+++ b/llms.txt
@@ -191,6 +191,18 @@ Each page plays one technique live and gives a ready-made prompt that describes
- [Light Rays](https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/light-rays/): Soft beams of light fall from above and slowly sweep across. Best for hero intros.
- [Game of Life](https://matinmonshizadeh.github.io/animation-handbook/animations/07-ambient-background/game-of-life/): Cells live and die by their neighbors, and patterns grow. Best for tech sites.
+## Skill files
+
+- [SKILL.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/SKILL.md): how to find a technique, choose its settings and build it, with the rules every animation follows
+- [references/catalog.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/catalog.md): all 166 in one list, with what each does and where it goes, and an index by place
+- [references/01-scroll-based.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/01-scroll-based.md): the 27 Scroll-Based entries, each with its prompt and settings
+- [references/02-entrance-and-exit.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/02-entrance-and-exit.md): the 14 Entrance & Exit entries, each with its prompt and settings
+- [references/03-page-transitions.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/03-page-transitions.md): the 16 Page Transitions entries, each with its prompt and settings
+- [references/04-micro-interactions.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/04-micro-interactions.md): the 41 Micro-Interactions entries, each with its prompt and settings
+- [references/05-text-typography.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/05-text-typography.md): the 19 Text & Typography entries, each with its prompt and settings
+- [references/06-3d-advanced.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/06-3d-advanced.md): the 26 3D & Advanced entries, each with its prompt and settings
+- [references/07-ambient-background.md](https://matinmonshizadeh.github.io/animation-handbook/skills/animation-handbook/references/07-ambient-background.md): the 23 Ambient & Background entries, each with its prompt and settings
+
## Optional
- [Source on GitHub](https://github.com/matinmonshizadeh/animation-handbook): every demo's code, each technique's README and the Agent Skill
diff --git a/skills/animation-handbook/SKILL.md b/skills/animation-handbook/SKILL.md
index e038cf93..7b6ce9db 100644
--- a/skills/animation-handbook/SKILL.md
+++ b/skills/animation-handbook/SKILL.md
@@ -1,6 +1,6 @@
---
name: animation-handbook
-description: Builds web animations from Animation Handbook, a set of 166 tested techniques with plain-words build prompts and settings (scroll effects, entrances and exits, page transitions, micro-interactions for buttons and forms, text effects, 3D and WebGL, ambient backgrounds). Use when the user asks to add, pick or improve an animation, transition, hover or click effect, loading state, scroll effect or background motion in a web page or app, in any framework or plain HTML, CSS and JavaScript.
+description: Builds web animations from Animation Handbook, a set of 166 tested techniques with plain-words build prompts and settings (scroll effects, entrances and exits, page transitions, micro-interactions for buttons and forms, text effects, 3D and WebGL, ambient backgrounds). Use when the user asks to add, pick or improve an animation, transition, hover or click effect, loading state, scroll effect or background motion in a web page or web app, in any framework or plain HTML, CSS and JavaScript.
license: MIT
---
@@ -10,21 +10,23 @@ license: MIT
## How to use it
-1. **Find the technique** in [references/catalog.md](references/catalog.md): one line per animation, with what it does, what it is best for and its places, the parts of a page it suits (Buttons, Text, Images & cards, Backgrounds, Menus & forms, Loading & messages, Page intros, Scrolling, Page changes). Match both what the user describes and where it goes. When two fit equally well, build one and mention the other.
-2. **Read its entry** in the category file the catalog line names: the prompt, the settings with their defaults, how it runs, what it is good for and what to avoid it on. If the user's place is on its Avoid on list, say so and suggest a better fit from the catalog.
-3. **Choose the settings** from the user's words: "a panel that slides in slowly from the left" picks the slow speed and the left side. Keep the default (in bold) for anything they did not mention, and ask only when a choice changes the result a lot and nothing they said points either way. The choices are named, not numbered, so turn each into values that fit its name and the project.
+1. **Find the technique** in [references/catalog.md](references/catalog.md): one line per animation, with what it does, what it is best for and its places, the parts of a page it suits (Buttons, Text, Images & cards, Backgrounds, Menus & forms, Loading & messages, Page intros, Scrolling, Page changes). Match both what the user describes and where it goes. When two fit equally well, build one and mention the other. If nothing fits, say so and build what the user asked for with the rules below.
+2. **Read its entry** in the category file the catalog line names. The files are long, so find the heading with the technique's name and read down to the next heading: the prompt, the settings with their defaults, how it runs, what it is good for and what to avoid it on. If the user's place is on its Avoid on list, say so and suggest a better fit from the catalog.
+3. **Choose the settings** from the user's words: "a panel that slides in slowly from the left" picks the slow speed and the left side. Keep the default (in bold) for anything they did not mention, and ask only when a choice changes the result a lot and nothing they said points either way. The choices are named, not numbered: the technique's README gives the demo's own values for many of them (see the end of this file); otherwise choose values that fit the name and the project.
4. **Build it** in the user's own stack, from plain HTML, CSS and JavaScript to React, Vue, Svelte or whatever the project already uses. Follow the prompt as the specification, with the user's own element in place of each [part in square brackets]. "Match the settings listed below" means the settings from step 3; the line at the end of each entry shows how the site lists them.
5. **Check it** against the rules below, then tell the user which technique you built, with its live demo address, and which settings you chose.
+When the user only asks which animation to use, suggest one or two from the catalog with their live demo addresses, and build once they choose. To improve an animation the project already has, find its closest technique the same way and change only what falls short of that prompt and the rules below.
+
## The rules every animation follows
The handbook's demos follow these rules and the prompts take them for granted, so keep them even where a prompt does not repeat them.
-- **Animate transform and opacity only.** Move, scale, rotate and fade; never animate width, height, top, left or box-shadow, which make the browser lay out or repaint the page on every frame.
+- **Move with transform and fade with opacity.** Never animate width, height, top, left or box-shadow, which make the browser lay out or repaint the page on every frame. Where a prompt asks for something else, such as a blur, a clip, a line that draws itself, a color change or a font weight, follow the prompt: it says how to keep that smooth.
- **Move a JavaScript frame loop by elapsed time.** Each frame moves by the time since the last one, capped at about 50 ms, never by a fixed step per frame, so it runs at the same speed on a 30 Hz, 60 Hz or 120 Hz screen.
- **Follow reduced motion.** When the device asks for reduced motion, show the end state or a short fade instead of the movement, and start loops paused.
- **Give a hover or a drag a touch equivalent.** A hover effect also works with a tap, and a drag uses pointer events so that touch works too.
-- **Make it work from the keyboard.** An effect that follows the pointer or shows on hover also shows on keyboard focus, and the arrow keys move what follows the pointer. An effect that starts on a press also starts on Enter or Space, from the middle of the control.
+- **Make it work from the keyboard.** An effect that shows on hover also shows on keyboard focus. An effect that follows the pointer inside its own area, such as a card or a button, works from the keyboard when that area has focus: focus shows it and the arrow keys move it. A page-wide effect, such as a custom cursor or an image trail, never takes over the arrow keys, which scroll the page. An effect that starts on a press also starts on Enter or Space, from the middle of the control.
- **Keep controls at least 44×44 px on phones**, buttons and handles drawn inside the animation included.
- **Keep text at least 4.5:1 against its background.**
- **Give heavy effects a lighter phone version.** A big blur, many particles or a shader gets a lighter version on phones, which are up to 600 px wide, or up to 500 px tall when held sideways.
@@ -41,4 +43,4 @@ The handbook's demos follow these rules and the prompts take them for granted, s
- [references/06-3d-advanced.md](references/06-3d-advanced.md): 3D & Advanced, 26 animations. WebGL, shaders, particles, 3D transforms, simulations, and other heavier effects.
- [references/07-ambient-background.md](references/07-ambient-background.md): Ambient & Background, 23 animations. Passive, looping effects that hold visual interest without demanding attention — gradients, particles, grain, and glows.
-The end of each live demo address (animations/02-entrance-and-exit/rotate-in/, for example) is also the technique's folder in the repository, https://github.com/matinmonshizadeh/animation-handbook: it holds the demo's own code and a README on how it works, the values that matter and production notes.
+Each live demo address is also the technique's folder in the repository, https://github.com/matinmonshizadeh/animation-handbook. Add README.md to the address (https://matinmonshizadeh.github.io/animation-handbook/animations/02-entrance-and-exit/rotate-in/README.md, for example) to read its README as plain text: how it works, the values behind each setting's choices and production notes. The address itself is the demo, with all of its code in the page.
diff --git a/skills/animation-handbook/references/02-entrance-and-exit.md b/skills/animation-handbook/references/02-entrance-and-exit.md
index ba52d198..c588f443 100644
--- a/skills/animation-handbook/references/02-entrance-and-exit.md
+++ b/skills/animation-handbook/references/02-entrance-and-exit.md
@@ -208,7 +208,7 @@ Add a letter-by-letter entrance to [a short phrase or headline]. In the cascade
- Delay between letters: Short · **Medium** · Long
- How each letter appears: **Fade up** · Fade · Grow · Flip
- Speed: Slow · **Normal** · Fast
-- Blinking cursor: **on** · off (only with some choices of another setting)
+- Blinking cursor: **on** · off (the page shows it only for some choices of another setting, and copies it only then)
- Your text: text field, starts as "Hello, world."
Copied from the site with the defaults, the prompt ends with this line:
diff --git a/skills/animation-handbook/references/05-text-typography.md b/skills/animation-handbook/references/05-text-typography.md
index 6b8915e1..1b6d281a 100644
--- a/skills/animation-handbook/references/05-text-typography.md
+++ b/skills/animation-handbook/references/05-text-typography.md
@@ -161,7 +161,7 @@ Add a marquee to [the text or items you want to scroll]. The text should scroll
- Speed: Slow · **Normal** · Fast
- Text size: Small · **Medium** · Large
- Space between items: Tight · **Medium** · Wide
-- Separator: Dot · · Star ★ · Dash — · **Sparkle ✦**
+- Separator: "Dot ·" · Star ★ · Dash — · **Sparkle ✦**
- Your text: text field, starts as "Animation Handbook"
Copied from the site with the defaults, the prompt ends with this line:
@@ -210,8 +210,8 @@ Add a flowing color gradient to [your headline or logo text]. Fill the letters w
- Gradient: **Flowing** · Spinning · Diagonal · Two colors
- Speed: Slow · **Normal** · Fast
-- First color: Pink · White · **Blue** · Purple · Green · Orange (only with some choices of another setting)
-- Second color: Pink · White · Blue · **Purple** · Green · Orange (only with some choices of another setting)
+- First color: Pink · White · **Blue** · Purple · Green · Orange (the page shows it only for some choices of another setting, and copies it only then)
+- Second color: Pink · White · Blue · **Purple** · Green · Orange (the page shows it only for some choices of another setting, and copies it only then)
- Your text: text field, starts as "Flow"
Copied from the site with the defaults, the prompt ends with this line:
diff --git a/tests/skill.test.js b/tests/skill.test.js
index 384caad4..646ae812 100644
--- a/tests/skill.test.js
+++ b/tests/skill.test.js
@@ -57,19 +57,27 @@ function homeConst(name) {
return vm.runInNewContext('(' + HOME.slice(from, blockEnd(from) + 1) + ')');
}
-// The labels of a page's settings: the name of each setting in Try it (the p or label with class hb-setting-name, or the
-// words beside a switch), or the label its control sets with data-hb-label. A setting marked data-hb-skip only compares the
-// demo with something else and is never copied, so it is left out; one marked hidden shows (and is copied) with some choices
-// of another setting, so it counts.
-function settingLabels(html) {
+// The settings of a page as { label, chosen }: the name of each setting in Try it (the p or label with class
+// hb-setting-name, or the words beside a switch), or the label its control sets with data-hb-label, and the choice it
+// starts with where it has one: the name of its button marked aria-pressed="true" (its aria-label, else its words), or on
+// or off for a switch, by whether it is checked. A setting marked data-hb-skip only compares the demo with something else
+// and is never copied, so it is left out; one marked hidden shows (and is copied) with some choices of another setting,
+// so it counts.
+function settingsOf(html) {
const tryIt = between(html, '<section class="hb-step hb-try"', '<section class="hb-step hb-prompt-step"');
+ const words = s => decode(s.replace(/<[^>]*>/g, '')).replace(/\s+/g, ' ').trim();
return tryIt.split('<div class="hb-setting"').slice(1)
.filter(part => !/^[^>]*\sdata-hb-skip(?=[\s=>])/.test(part))
.flatMap(part => {
const own = part.match(/\sdata-hb-label="([^"]+)"/);
- if (own) return [decode(own[1])];
- return [...part.matchAll(/<(p|label) class="hb-setting-name"[^>]*>([^<]*)<\/\1>|<label class="hb-switch-row"><span>([^<]*)<\/span>/g)]
+ const labels = own ? [decode(own[1])] : [...part.matchAll(/<(p|label) class="hb-setting-name"[^>]*>([^<]*)<\/\1>|<label class="hb-switch-row"><span>([^<]*)<\/span>/g)]
.map(m => decode((m[2] ?? m[3]).trim()));
+ const group = part.match(/<div\b(?=[^>]*\sclass="(?:[^"]*\s)?(?:seg|swatches)(?:\s[^"]*)?")[^>]*>([\s\S]*?)<\/div>/);
+ const pressed = group && [...group[1].matchAll(/<button\b([^>]*)>([\s\S]*?)<\/button>/g)].find(b => /\saria-pressed="true"/.test(b[1]));
+ const toggle = part.match(/<input\b[^>]*\stype="checkbox"[^>]*>/);
+ const chosen = pressed ? decode((pressed[1].match(/\saria-label="([^"]*)"/) || [])[1] || '') || words(pressed[2])
+ : toggle ? (/\schecked(?=[\s>])/.test(toggle[0]) ? 'on' : 'off') : undefined;
+ return labels.map(label => ({ label, chosen }));
});
}
@@ -119,7 +127,7 @@ test('SKILL.md has only a name, a description and a license, and a short body th
for (const file of files) assert.ok(parts[2].includes(`](references/${file})`), `SKILL.md links references/${file}`);
});
-test('every page has one entry in its category file and one line in the catalog, holding its prompt and every setting', () => {
+test('every page has one entry in its category file and one line in the catalog, holding its prompt and every setting with its default', () => {
assert.ok(pages.length > 0, 'there are guided-steps pages');
const catalog = read(path.join(REFS, 'catalog.md'));
const problems = [];
@@ -134,14 +142,19 @@ test('every page has one entry in its category file and one line in the catalog,
const html = read(d.file);
const prompt = decode(html.match(/<p class="hb-prompt">([^<]*)<\/p>/)[1]).replace(/\s+/g, ' ').trim();
if (!entries[0].includes(`\n${prompt}\n`)) problems.push(`${where}: its entry does not hold the page's prompt word for word`);
- for (const label of settingLabels(html)) {
- if (!entries[0].includes(`\n- ${label}: `)) problems.push(`${where}: its entry has no line for the setting "${label}"`);
+ for (const { label, chosen } of settingsOf(html)) {
+ const line = entries[0].split('\n').find(l => l.startsWith(`- ${label}: `));
+ if (!line) { problems.push(`${where}: its entry has no line for the setting "${label}"`); continue; }
+ if (chosen === undefined) continue; // a text field starts with its text, not a choice
+ // The one choice in bold is the one the page starts with (a name holding "·" is quoted).
+ const bold = `**${chosen.includes('·') ? `"${chosen}"` : chosen}**`;
+ if (!line.includes(bold) || line.split('**').length !== 3) problems.push(`${where}: "${label}" does not show ${bold} as its only default: ${line}`);
}
}
assert.deepEqual(problems, [], `run ${TOOL} after changing a page`);
});
-test('llms.txt lists every card once, in the order of CATS, with its live address and its description', () => {
+test('llms.txt lists every card once, in the order of CATS, with its live address and its description, and links the skill files', () => {
const text = read(path.join(ROOT, 'llms.txt'));
const cards = homeConst('CATS').flatMap(cat => cat.entries.map(([slug, , desc]) => ({ address: `${LIVE}${cat.folder}/${slug}/`, desc })));
assert.ok(text.startsWith('# Animation Handbook\n'), 'llms.txt starts with the title');
@@ -152,6 +165,11 @@ test('llms.txt lists every card once, in the order of CATS, with its live addres
assert.ok(lines[i].includes(`](${card.address}): `), `line ${i + 1} links ${card.address}: ${lines[i]}`);
assert.ok(lines[i].endsWith(`: ${card.desc}`), `line ${i + 1} ends with the card's description: ${lines[i]}`);
});
+ // The skill's files too, at their addresses on the live site, each with a few words on what it holds.
+ for (const file of ['SKILL.md', 'references/catalog.md', ...categories.map(cat => `references/${cat}.md`)]) {
+ const address = `${LIVE}skills/animation-handbook/${file}`;
+ assert.ok(text.split('\n').some(line => /^- \[[^\]]+\]\(/.test(line) && line.includes(`](${address}): `)), `llms.txt links ${address}`);
+ }
});
test('the plugin marketplace parses and its one plugin installs the skill folder', () => {
diff --git a/tools/make-skill.mjs b/tools/make-skill.mjs
index c8ff8ba3..d0965aec 100644
--- a/tools/make-skill.mjs
+++ b/tools/make-skill.mjs
@@ -19,9 +19,9 @@
// writes nothing.
// Exit code 1 when a card has no page, a page lacks a part the skill needs, or the skill folder holds a file this tool
// does not write.
-import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
+import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
import { createRequire } from 'node:module';
-import { dirname, join, relative, resolve, sep } from 'node:path';
+import { dirname, join, relative, sep } from 'node:path';
import { fileURLToPath } from 'node:url';
import vm from 'node:vm';
@@ -204,8 +204,9 @@ function readPage(root, folder, slug, DemoPage) {
const settings = items.map(({ label, value, control }, i) => {
if (!label) throw new Error(`${where}: a setting in Try it has no label (the page leaves it out of Copy prompt)`);
let text = describe(control, value, phoneItems[i].value);
+ if (!text) throw new Error(`${where}: the setting "${label}" has no choices`);
for (let n = control; n !== tryStep; n = n.parentElement) {
- if (n.hasAttribute('hidden')) { text += ' (only with some choices of another setting)'; break; }
+ if (n.hasAttribute('hidden')) { text += ' (the page shows it only for some choices of another setting, and copies it only then)'; break; }
}
return { label, text };
});
@@ -221,7 +222,9 @@ function readPage(root, folder, slug, DemoPage) {
// A setting's choices in plain words: the default in bold, the phone default named where a page starts lower there.
function describe(control, value, phoneValue) {
const phone = phoneValue !== value ? ` (phones start with ${phoneValue})` : '';
- const choice = el => el.getAttribute('aria-label') || squeeze(el.textContent); // as the page script names a choice
+ // A name that holds the separator itself (the choice "Dot ·") is quoted, so the list stays readable.
+ const named = name => (name.includes('·') ? `"${name}"` : name);
+ const choice = el => named(el.getAttribute('aria-label') || squeeze(el.textContent)); // as the page script names a choice
if (control.matches('.seg, .swatches')) {
const pressed = control.querySelector('.on, [aria-pressed="true"]');
return control.querySelectorAll('button').map(b => (b === pressed ? `**${choice(b)}**` : choice(b))).join(' · ') + phone;
@@ -238,7 +241,7 @@ function describe(control, value, phoneValue) {
}
if (control.matches('select')) {
const chosen = control.selectedOptions[0];
- return control.querySelectorAll('option').map(o => (o === chosen ? `**${squeeze(o.textContent)}**` : squeeze(o.textContent))).join(' · ') + phone;
+ return control.querySelectorAll('option').map(o => (o === chosen ? `**${named(squeeze(o.textContent))}**` : named(squeeze(o.textContent)))).join(' · ') + phone;
}
return `slider, starts at ${value}` + phone;
}
@@ -264,21 +267,23 @@ const SKILL_BODY = ({ total, base, cats }) => `# Animation Handbook
## How to use it
-1. **Find the technique** in [references/catalog.md](references/catalog.md): one line per animation, with what it does, what it is best for and its places, the parts of a page it suits (${cats.places}). Match both what the user describes and where it goes. When two fit equally well, build one and mention the other.
-2. **Read its entry** in the category file the catalog line names: the prompt, the settings with their defaults, how it runs, what it is good for and what to avoid it on. If the user's place is on its Avoid on list, say so and suggest a better fit from the catalog.
-3. **Choose the settings** from the user's words: "a panel that slides in slowly from the left" picks the slow speed and the left side. Keep the default (in bold) for anything they did not mention, and ask only when a choice changes the result a lot and nothing they said points either way. The choices are named, not numbered, so turn each into values that fit its name and the project.
+1. **Find the technique** in [references/catalog.md](references/catalog.md): one line per animation, with what it does, what it is best for and its places, the parts of a page it suits (${cats.places}). Match both what the user describes and where it goes. When two fit equally well, build one and mention the other. If nothing fits, say so and build what the user asked for with the rules below.
+2. **Read its entry** in the category file the catalog line names. The files are long, so find the heading with the technique's name and read down to the next heading: the prompt, the settings with their defaults, how it runs, what it is good for and what to avoid it on. If the user's place is on its Avoid on list, say so and suggest a better fit from the catalog.
+3. **Choose the settings** from the user's words: "a panel that slides in slowly from the left" picks the slow speed and the left side. Keep the default (in bold) for anything they did not mention, and ask only when a choice changes the result a lot and nothing they said points either way. The choices are named, not numbered: the technique's README gives the demo's own values for many of them (see the end of this file); otherwise choose values that fit the name and the project.
4. **Build it** in the user's own stack, from plain HTML, CSS and JavaScript to React, Vue, Svelte or whatever the project already uses. Follow the prompt as the specification, with the user's own element in place of each [part in square brackets]. "Match the settings listed below" means the settings from step 3; the line at the end of each entry shows how the site lists them.
5. **Check it** against the rules below, then tell the user which technique you built, with its live demo address, and which settings you chose.
+When the user only asks which animation to use, suggest one or two from the catalog with their live demo addresses, and build once they choose. To improve an animation the project already has, find its closest technique the same way and change only what falls short of that prompt and the rules below.
+
## The rules every animation follows
The handbook's demos follow these rules and the prompts take them for granted, so keep them even where a prompt does not repeat them.
-- **Animate transform and opacity only.** Move, scale, rotate and fade; never animate width, height, top, left or box-shadow, which make the browser lay out or repaint the page on every frame.
+- **Move with transform and fade with opacity.** Never animate width, height, top, left or box-shadow, which make the browser lay out or repaint the page on every frame. Where a prompt asks for something else, such as a blur, a clip, a line that draws itself, a color change or a font weight, follow the prompt: it says how to keep that smooth.
- **Move a JavaScript frame loop by elapsed time.** Each frame moves by the time since the last one, capped at about 50 ms, never by a fixed step per frame, so it runs at the same speed on a 30 Hz, 60 Hz or 120 Hz screen.
- **Follow reduced motion.** When the device asks for reduced motion, show the end state or a short fade instead of the movement, and start loops paused.
- **Give a hover or a drag a touch equivalent.** A hover effect also works with a tap, and a drag uses pointer events so that touch works too.
-- **Make it work from the keyboard.** An effect that follows the pointer or shows on hover also shows on keyboard focus, and the arrow keys move what follows the pointer. An effect that starts on a press also starts on Enter or Space, from the middle of the control.
+- **Make it work from the keyboard.** An effect that shows on hover also shows on keyboard focus. An effect that follows the pointer inside its own area, such as a card or a button, works from the keyboard when that area has focus: focus shows it and the arrow keys move it. A page-wide effect, such as a custom cursor or an image trail, never takes over the arrow keys, which scroll the page. An effect that starts on a press also starts on Enter or Space, from the middle of the control.
- **Keep controls at least 44×44 px on phones**, buttons and handles drawn inside the animation included.
- **Keep text at least 4.5:1 against its background.**
- **Give heavy effects a lighter phone version.** A big blur, many particles or a shader gets a lighter version on phones, which are up to 600 px wide, or up to 500 px tall when held sideways.
@@ -289,7 +294,7 @@ The handbook's demos follow these rules and the prompts take them for granted, s
- [references/catalog.md](references/catalog.md): all ${total} in one list, grouped by category, with an index by place.
${cats.lines}
-The end of each live demo address (animations/02-entrance-and-exit/rotate-in/, for example) is also the technique's folder in the repository, ${REPO}: it holds the demo's own code and a README on how it works, the values that matter and production notes.
+Each live demo address is also the technique's folder in the repository, ${REPO}. Add README.md to the address (${base}animations/02-entrance-and-exit/rotate-in/README.md, for example) to read its README as plain text: how it works, the values behind each setting's choices and production notes. The address itself is the demo, with all of its code in the page.
`;
export function buildSkill(root) {
@@ -320,7 +325,7 @@ export function buildSkill(root) {
files[`${SKILL}/SKILL.md`] = [
'---',
'name: animation-handbook',
- `description: Builds web animations from Animation Handbook, a set of ${total} tested techniques with plain-words build prompts and settings (scroll effects, entrances and exits, page transitions, micro-interactions for buttons and forms, text effects, 3D and WebGL, ambient backgrounds). Use when the user asks to add, pick or improve an animation, transition, hover or click effect, loading state, scroll effect or background motion in a web page or app, in any framework or plain HTML, CSS and JavaScript.`,
+ `description: Builds web animations from Animation Handbook, a set of ${total} tested techniques with plain-words build prompts and settings (scroll effects, entrances and exits, page transitions, micro-interactions for buttons and forms, text effects, 3D and WebGL, ambient backgrounds). Use when the user asks to add, pick or improve an animation, transition, hover or click effect, loading state, scroll effect or background motion in a web page or web app, in any framework or plain HTML, CSS and JavaScript.`,
'license: MIT',
'---',
'',
@@ -361,6 +366,11 @@ export function buildSkill(root) {
`Each page plays one technique live and gives a ready-made prompt that describes it in plain words, with no code. Most pages also have a few plain settings, such as speed or direction, and the prompt you copy lists your choices. Each technique's folder on GitHub has a README on how it works, the values that matter and production notes. To give an AI coding assistant all ${total} prompts and settings at once, install the Agent Skill: \`npx skills add matinmonshizadeh/animation-handbook\`.`, '',
...CATS.flatMap(cat => [`## ${cat.name}`, '',
...cat.entries.map(([slug, name, desc]) => `- [${name}](${base}${cat.folder.replace(/\/$/, '')}/${slug}/): ${desc}`), '']),
+ // The skill's own files, which the site serves as they are: every prompt and setting, as Markdown.
+ '## Skill files', '',
+ `- [SKILL.md](${base}${SKILL}/SKILL.md): how to find a technique, choose its settings and build it, with the rules every animation follows`,
+ `- [references/catalog.md](${base}${SKILL}/references/catalog.md): all ${total} in one list, with what each does and where it goes, and an index by place`,
+ ...cats.map(cat => `- [references/${cat.file}](${base}${SKILL}/references/${cat.file}): the ${cat.pages.length} ${cat.name} entries, each with its prompt and settings`), '',
'## Optional', '',
`- [Source on GitHub](${REPO}): every demo's code, each technique's README and the Agent Skill`, ''
].join('\n');
@@ -368,7 +378,9 @@ export function buildSkill(root) {
}
// Run as a command, not imported by the test: write the files that changed and print them all.
-if (process.argv[1] && resolve(process.argv[1]).toLowerCase() === fileURLToPath(import.meta.url).toLowerCase()) {
+// The command's path is compared with its real path, so a run through a junction or a link counts too.
+const self = (() => { try { return realpathSync(process.argv[1]); } catch { return ''; } })();
+if (self.toLowerCase() === fileURLToPath(import.meta.url).toLowerCase()) {
const ROOT = fileURLToPath(new URL('..', import.meta.url));
try {
const files = buildSkill(ROOT);