@ericrisco/rsc 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -4
- package/manifest.json +231 -3
- package/package.json +2 -1
- package/scripts/build-manifest.js +20 -4
- package/scripts/detect-repo.js +27 -1
- package/scripts/lib/domains.js +3 -2
- package/scripts/lib/skill-lint.js +29 -0
- package/scripts/lib/spec-gate.js +122 -0
- package/scripts/spec-gate.js +58 -0
- package/skills/animate/SKILL.md +228 -0
- package/skills/animate/evals/cases.yaml +36 -0
- package/skills/animate/references/recipes.md +324 -0
- package/skills/animate-expo/SKILL.md +281 -0
- package/skills/animate-expo/evals/cases.yaml +36 -0
- package/skills/animate-expo/references/recipes.md +385 -0
- package/skills/animation-vocabulary/SKILL.md +189 -0
- package/skills/animation-vocabulary/evals/cases.yaml +31 -0
- package/skills/apple-design/SKILL.md +301 -0
- package/skills/apple-design/evals/cases.yaml +33 -0
- package/skills/ask-sonner/SKILL.md +104 -0
- package/skills/ask-sonner/evals/cases.yaml +33 -0
- package/skills/ask-sonner/references/api.md +64 -0
- package/skills/clarify/SKILL.md +26 -2
- package/skills/design/SKILL.md +8 -0
- package/skills/design/references/motion-and-interaction.md +14 -3
- package/skills/design/references/visual-system.md +4 -3
- package/skills/design-eng/SKILL.md +724 -0
- package/skills/design-eng/evals/cases.yaml +36 -0
- package/skills/expo/SKILL.md +6 -0
- package/skills/find-animation-opportunities/SKILL.md +150 -0
- package/skills/find-animation-opportunities/evals/cases.yaml +31 -0
- package/skills/improve-animations/SKILL.md +126 -0
- package/skills/improve-animations/evals/cases.yaml +31 -0
- package/skills/improve-animations/references/audit.md +115 -0
- package/skills/improve-animations/references/plan-template.md +73 -0
- package/skills/pick-ui-library/SKILL.md +100 -0
- package/skills/pick-ui-library/evals/cases.yaml +33 -0
- package/skills/prototype/SKILL.md +113 -0
- package/skills/prototype/evals/cases.yaml +31 -0
- package/skills/prototype/references/picker.md +197 -0
- package/skills/react/SKILL.md +6 -0
- package/skills/react-native/SKILL.md +5 -0
- package/skills/review-animations/SKILL.md +137 -0
- package/skills/review-animations/evals/cases.yaml +34 -0
- package/skills/review-animations/references/standards.md +187 -0
- package/skills/review-animations/scripts/verify.sh +164 -0
- package/skills/specify/SKILL.md +77 -26
- package/skills/specify/evals/cases.yaml +4 -4
- package/skills/specify/references/eliciting-requirements.md +50 -10
- package/skills/specify/references/spec-template.md +19 -5
- package/skills/swift-ios/SKILL.md +7 -0
- package/skills/write-swift/SKILL.md +413 -0
- package/skills/write-swift/evals/cases.yaml +36 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// The exit gate of the `specify` phase, as a binary instead of a feeling.
|
|
2
|
+
//
|
|
3
|
+
// "Stop when the WHAT and WHY are complete enough to plan against" cannot tell done from not-done,
|
|
4
|
+
// so the phase closed whenever the agent felt closed — with the write/review/approve steps visible
|
|
5
|
+
// the whole time, pulling attention toward being finished. This checks the artifact instead: every
|
|
6
|
+
// template section carries content or an explicit open point.
|
|
7
|
+
//
|
|
8
|
+
// What it does NOT check is returned in `unchecked`, on purpose. Detecting an unmarked assumption is
|
|
9
|
+
// the problem `specify` exists to solve, not something a parser can do, and a gate that implies
|
|
10
|
+
// otherwise is worse than one that admits its edge.
|
|
11
|
+
|
|
12
|
+
// The four states a point can be in. Order is the table's order in the skill body.
|
|
13
|
+
export const OPEN_POINT_TYPES = [
|
|
14
|
+
'pregunta abierta', // formulable now, unanswered → clarify asks it
|
|
15
|
+
'suposición tomada', // we decided, with the basis written → clarify validates it
|
|
16
|
+
'decisión diferida', // sharp, out of this cycle on purpose → clarify leaves it
|
|
17
|
+
'área no formulable', // known to be coming, not yet sharp → clarify notes it
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
// The corpus is Spanish, the template is English, and both carry drifting parentheticals
|
|
21
|
+
// ("Objetivos (resultado)", "Criterios de aceptación (binarios)"). Matching literal strings would
|
|
22
|
+
// be useless, so each family is a set of normalised prefixes.
|
|
23
|
+
const FAMILIES = {
|
|
24
|
+
problem: ['problema & por que', 'problema y por que', 'problem & why'],
|
|
25
|
+
goals: ['objetivos', 'goals'],
|
|
26
|
+
nongoals: ['no-objetivos', 'no objetivos', 'non-goals'],
|
|
27
|
+
users: ['usuarios & contexto', 'usuarios y contexto', 'users & context'],
|
|
28
|
+
behaviour: ['comportamiento', 'behaviour', 'behavior'],
|
|
29
|
+
acceptance: ['criterios de aceptacion', 'acceptance criteria'],
|
|
30
|
+
open: ['puntos a clarificar', 'puntos de clarify', 'puntos que siguen abiertos', 'points to clarify'],
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const UNCHECKED = [
|
|
34
|
+
'que ninguna sección contenga una suposición sin marcar (no es detectable por máquina; es el juicio que la fase existe para ejercer)',
|
|
35
|
+
'que el contenido de cada sección sea correcto, y no sólo presente',
|
|
36
|
+
'que los criterios de aceptación sean de verdad binarios',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
function fold(s) {
|
|
40
|
+
return s
|
|
41
|
+
.normalize('NFD')
|
|
42
|
+
.replace(/[̀-ͯ]/g, '')
|
|
43
|
+
.toLowerCase()
|
|
44
|
+
.trim();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function familyOf(heading) {
|
|
48
|
+
const h = fold(heading);
|
|
49
|
+
for (const [family, prefixes] of Object.entries(FAMILIES)) {
|
|
50
|
+
if (prefixes.some((p) => h.startsWith(p))) return family;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// A heading with nothing under it is not a filled section. Neither is one holding only the
|
|
56
|
+
// template's own italic/angle-bracket guidance, which is what a hurried pass leaves behind.
|
|
57
|
+
function isSubstantive(line) {
|
|
58
|
+
const t = line.trim();
|
|
59
|
+
if (!t) return false;
|
|
60
|
+
if (/^<.*>$/.test(t)) return false; // <guidance from the template>
|
|
61
|
+
if (/^\*[^*].*\*$/.test(t) && t.length < 200) return false; // *italic guidance*
|
|
62
|
+
if (/^(-|\*)\s*$/.test(t)) return false; // an empty bullet
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function parseOpenPoints(lines) {
|
|
67
|
+
const points = [];
|
|
68
|
+
for (const line of lines) {
|
|
69
|
+
const m = line.match(/^\s*[-*]\s+(?:\[[ x]\]\s*)?(.*)$/);
|
|
70
|
+
if (!m || !m[1].trim()) continue;
|
|
71
|
+
const body = m[1];
|
|
72
|
+
const declared = OPEN_POINT_TYPES.find((t) => {
|
|
73
|
+
const re = new RegExp(`^\\*\\*\\s*${t.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*\\*\\*`, 'i');
|
|
74
|
+
return re.test(fold(body)) || re.test(body);
|
|
75
|
+
});
|
|
76
|
+
points.push({
|
|
77
|
+
type: declared || OPEN_POINT_TYPES[0], // the costliest default: treat it as a real question
|
|
78
|
+
typed: Boolean(declared),
|
|
79
|
+
text: body.trim(),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return points;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @param {string} markdown a written spec file
|
|
87
|
+
* @returns {{ok: boolean, missing: string[], empty: string[],
|
|
88
|
+
* openPoints: Array<{type: string, typed: boolean, text: string}>,
|
|
89
|
+
* untyped: string[], unchecked: string[]}}
|
|
90
|
+
*/
|
|
91
|
+
export function specCompleteness(markdown) {
|
|
92
|
+
const lines = String(markdown ?? '').split('\n');
|
|
93
|
+
const sections = new Map(); // family -> body lines
|
|
94
|
+
|
|
95
|
+
let current = null;
|
|
96
|
+
for (const line of lines) {
|
|
97
|
+
const h = line.match(/^##\s+(.*)$/);
|
|
98
|
+
if (h) {
|
|
99
|
+
const fam = familyOf(h[1]);
|
|
100
|
+
current = fam;
|
|
101
|
+
if (fam && !sections.has(fam)) sections.set(fam, []);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (current && sections.has(current)) sections.get(current).push(line);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const families = Object.keys(FAMILIES);
|
|
108
|
+
const missing = families.filter((f) => !sections.has(f));
|
|
109
|
+
const empty = families.filter((f) => sections.has(f) && !sections.get(f).some(isSubstantive));
|
|
110
|
+
|
|
111
|
+
const openPoints = sections.has('open') ? parseOpenPoints(sections.get('open')) : [];
|
|
112
|
+
const untyped = openPoints.filter((p) => !p.typed).map((p) => p.text);
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
ok: missing.length === 0 && empty.length === 0,
|
|
116
|
+
missing,
|
|
117
|
+
empty,
|
|
118
|
+
openPoints,
|
|
119
|
+
untyped,
|
|
120
|
+
unchecked: UNCHECKED,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Runs the `specify` exit gate over written specs. Report-only: it never edits a spec.
|
|
3
|
+
//
|
|
4
|
+
// Not wired into `prepublishOnly`, and that is deliberate: specs live under 02-DOCS, which is never
|
|
5
|
+
// tracked (principle 9), so a publish gate depending on them would fail in any clean clone. This is
|
|
6
|
+
// the phase's own instrument, and the author's.
|
|
7
|
+
import { readFileSync, readdirSync } from 'node:fs';
|
|
8
|
+
import { join, dirname, basename } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { specCompleteness } from './lib/spec-gate.js';
|
|
11
|
+
|
|
12
|
+
const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
13
|
+
const DEFAULT_DIR = join(ROOT, '02-DOCS', 'wiki', 'sdd', 'specs');
|
|
14
|
+
|
|
15
|
+
function defaultTargets() {
|
|
16
|
+
try {
|
|
17
|
+
return readdirSync(DEFAULT_DIR)
|
|
18
|
+
.filter((f) => f.endsWith('.md') && !f.endsWith('.plan.md'))
|
|
19
|
+
.map((f) => join(DEFAULT_DIR, f));
|
|
20
|
+
} catch {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function main() {
|
|
26
|
+
const args = process.argv.slice(2);
|
|
27
|
+
const targets = args.length ? args : defaultTargets();
|
|
28
|
+
if (!targets.length) {
|
|
29
|
+
console.log('no specs found — pass a path, or write one to 02-DOCS/wiki/sdd/specs/');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let failed = 0;
|
|
34
|
+
for (const path of targets) {
|
|
35
|
+
const r = specCompleteness(readFileSync(path, 'utf8'));
|
|
36
|
+
const name = basename(path);
|
|
37
|
+
if (r.ok) {
|
|
38
|
+
const typed = r.openPoints.length - r.untyped.length;
|
|
39
|
+
console.log(`PASS ${name} — ${r.openPoints.length} open point(s), ${typed} typed`);
|
|
40
|
+
if (r.untyped.length) {
|
|
41
|
+
console.log(` untyped (treated as open questions): ${r.untyped.length}`);
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
failed += 1;
|
|
45
|
+
console.log(`FAIL ${name}`);
|
|
46
|
+
if (r.missing.length) console.log(` missing section(s): ${r.missing.join(', ')}`);
|
|
47
|
+
if (r.empty.length) console.log(` section(s) with no content: ${r.empty.join(', ')}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// A green here is narrower than the rule it enforces, so it says so every run rather than
|
|
52
|
+
// letting the reader assume the gate covered more than it did.
|
|
53
|
+
console.log(`\n${targets.length - failed}/${targets.length} pass. Not checked by this gate:`);
|
|
54
|
+
for (const u of specCompleteness('').unchecked) console.log(` - ${u}`);
|
|
55
|
+
if (failed) process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
main();
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: animate
|
|
3
|
+
description: "Build a web animation: whether it should animate at all, the purpose, the tool, the properties, the easing curve, the duration, interruption and exit. Writes the CSS or Motion code for dropdowns, modals, toasts, tooltips, accordions, press feedback, stagger and scroll reveals. Use to animate something or make a component feel alive."
|
|
4
|
+
tags: [motion, animation, css, transitions, ui]
|
|
5
|
+
recommends: [review-animations, pick-ui-library, apple-design]
|
|
6
|
+
profiles: [full]
|
|
7
|
+
origin: emilkowalski (MIT, adapted)
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Building Animations
|
|
11
|
+
|
|
12
|
+
> **SDD gate.** If this fired on a **new, non-trivial feature or behaviour change** and there is
|
|
13
|
+
> **no approved spec + plan** under `02-DOCS/wiki/sdd/`, hand off to `../specify/SKILL.md` first —
|
|
14
|
+
> it runs brainstorm → spec → plan → tasks before any code, then routes back here once the plan is
|
|
15
|
+
> approved. Build straight from here only for a genuinely one-line / low-risk change, or a bug fix
|
|
16
|
+
> restoring intended behaviour. Method: `../sdd/SKILL.md`.
|
|
17
|
+
|
|
18
|
+
**Hand-offs.** The **visual system** — palette, type scale, spacing, brand grounding, landing
|
|
19
|
+
composition — is `../design/SKILL.md`'s; this skill only sets motion. **React Native / Expo** motion
|
|
20
|
+
is `../animate-expo/SKILL.md`'s: no hover, two runtimes, gestures as the baseline. **Gesture physics**
|
|
21
|
+
— velocity handoff, momentum projection, rubber-banding, translucent materials — is
|
|
22
|
+
`../apple-design/SKILL.md`'s. Reviewing motion someone else wrote is `../review-animations/SKILL.md`'s.
|
|
23
|
+
The countable half of the bar below is executable: `../review-animations/scripts/verify.sh` flags
|
|
24
|
+
`transition: all`, a `scale(0)` entrance, `ease-in` on UI, a centered popover origin, and motion with
|
|
25
|
+
no reduced-motion guard. Run it before you claim the animation is done.
|
|
26
|
+
|
|
27
|
+
A construction skill. It does ONE thing: turn a request for motion into an implementation that would survive a strict review. It does not audit a codebase (that's `improve-animations`), critique a diff (that's `review-animations`), hunt for places that could animate (that's `find-animation-opportunities`), or build for React Native (that's `animate-expo`).
|
|
28
|
+
|
|
29
|
+
## Operating Posture
|
|
30
|
+
|
|
31
|
+
You are a senior design engineer building the animation yourself. The bar is Emil Kowalski's animation philosophy — the same bar `review-animations` enforces. Write it so it passes that review the first time.
|
|
32
|
+
|
|
33
|
+
Two failure modes, and the first is worse:
|
|
34
|
+
|
|
35
|
+
1. **Animating something that shouldn't animate.** The gate below exists to produce zero lines of code sometimes. That's a success, not a dodge.
|
|
36
|
+
2. **Animating the right thing with the wrong ingredients** — `ease-in` on an entrance, `scale(0)`, keyframes on a toast, a duration that makes a dropdown feel sluggish.
|
|
37
|
+
|
|
38
|
+
Never present motion options as a menu. Make the call, state the reasoning in one line, write the code.
|
|
39
|
+
|
|
40
|
+
## Hard Rules
|
|
41
|
+
|
|
42
|
+
1. **Run the sequence in order.** Steps 1 and 2 gate everything. Don't reach for a curve before you know whether it animates at all.
|
|
43
|
+
2. **No approximated values.** Every curve, duration, and spring config comes from the tables below. Never invent `cubic-bezier(0.4, 0, 0.2, 1)` because it looks familiar.
|
|
44
|
+
3. **Extend the codebase's tokens, don't fork them.** If `--ease-out` or a duration scale already exists, use it. Adding a parallel system is a defect.
|
|
45
|
+
4. **Reduced motion and hover gating ship with the animation**, not as a follow-up.
|
|
46
|
+
5. **Cheapest tool that works.** Don't install a motion library for a fade.
|
|
47
|
+
|
|
48
|
+
## The Build Sequence
|
|
49
|
+
|
|
50
|
+
### 1. Should this animate at all?
|
|
51
|
+
|
|
52
|
+
| Frequency | Decision |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| 100+ times/day (keyboard shortcuts, command palette toggle) | **No animation. Ever.** Stop here. |
|
|
55
|
+
| Tens of times/day (hover effects, list navigation) | Near-imperceptible only — fast and subtle, or nothing |
|
|
56
|
+
| Occasional (modals, drawers, toasts) | Standard animation |
|
|
57
|
+
| Rare / first-time (onboarding, success, celebration) | The delight budget lives here |
|
|
58
|
+
|
|
59
|
+
**Keyboard-initiated actions are a disqualifier, not a judgment call.** Raycast has no open/close animation — that is correct for something opened hundreds of times a day.
|
|
60
|
+
|
|
61
|
+
If the request fails this gate, say so plainly and don't write the animation. Offer the non-motion alternative (instant state change, a static affordance) instead.
|
|
62
|
+
|
|
63
|
+
### 2. What is the purpose?
|
|
64
|
+
|
|
65
|
+
Name it in one of these words before continuing:
|
|
66
|
+
|
|
67
|
+
- **Feedback** — confirming the interface heard the user
|
|
68
|
+
- **Spatial consistency** — showing where something came from or went
|
|
69
|
+
- **State indication** — making a state change legible
|
|
70
|
+
- **Preventing a jarring change** — bridging content that would otherwise teleport
|
|
71
|
+
- **Explanation** — demonstrating how something works (marketing/onboarding only)
|
|
72
|
+
- **Delight** — allowed *only* at the rare/first-time tier
|
|
73
|
+
|
|
74
|
+
Can't name it? Don't build it. "It looks cool" on a frequently-seen element is a reason to stop.
|
|
75
|
+
|
|
76
|
+
Also check **function**: data the user is reading or acting on should not move for style. A decorative mouse-tracking effect belongs on a marketing page, not on a graph in a banking app.
|
|
77
|
+
|
|
78
|
+
### 3. Pick the tool — cheapest that works
|
|
79
|
+
|
|
80
|
+
Walk down; stop at the first that fits.
|
|
81
|
+
|
|
82
|
+
| Need | Tool |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| Hover, press, color, a state toggle you control with a class or attribute | **CSS transition** |
|
|
85
|
+
| Entry animation on mount, no JS state | **CSS `@starting-style`** |
|
|
86
|
+
| Predetermined motion that must stay smooth while the page is busy loading | **CSS animation** (runs off the main thread) |
|
|
87
|
+
| Programmatic control with CSS performance, no library | **WAAPI** (`element.animate()`) |
|
|
88
|
+
| Springs, layout animations, exit animations, gesture-driven values | **Motion** (`motion.dev`) |
|
|
89
|
+
|
|
90
|
+
CSS animations beat JS under load — they run off the main thread, while `requestAnimationFrame`-based animation drops frames while the browser loads, scripts, or paints. Use CSS for predetermined motion, JS for dynamic and interruptible motion.
|
|
91
|
+
|
|
92
|
+
If the task needs a *component* rather than an animation — a toast, a drawer, a command menu, a dropdown — stop and invoke `pick-ui-library`. Hand-rolling those is how you end up with a `<div>` dropdown and no focus management.
|
|
93
|
+
|
|
94
|
+
### 4. Pick the properties
|
|
95
|
+
|
|
96
|
+
- **`transform` and `opacity` only.** They skip layout and paint and run on the GPU. `width`/`height`/`margin`/`padding`/`top`/`left` trigger all three. (`clip-path` is the sanctioned fourth — see [references/recipes.md](references/recipes.md). `height` is tolerated only for accordions, where there's no transform equivalent.)
|
|
97
|
+
- **Never `scale(0)`.** Start from `scale(0.9–0.97)` + `opacity: 0`. Nothing in the real world appears from nothing.
|
|
98
|
+
- **`transform-origin` at the trigger** for popovers, dropdowns, menus, tooltips — `var(--transform-origin)` in Base UI. **Modals are exempt**; they're not anchored to a trigger, so they stay centered.
|
|
99
|
+
- **Percentages in `translate()`** are relative to the element's own size — `translateY(100%)` moves by its own height whatever the content. Prefer over hardcoded pixels.
|
|
100
|
+
- **In Motion, use the full transform string.** `x`/`y`/`scale` shorthands are not hardware-accelerated and drop frames under load:
|
|
101
|
+
|
|
102
|
+
```jsx
|
|
103
|
+
<motion.div animate={{ x: 100 }} /> // drops frames under load
|
|
104
|
+
<motion.div animate={{ transform: "translateX(100px)" }} /> // hardware accelerated
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- **Never drive a child's transform from a CSS variable on the parent** — it recalculates styles for every child. Set `transform` on the element directly.
|
|
108
|
+
|
|
109
|
+
### 5. Easing and duration — or a spring
|
|
110
|
+
|
|
111
|
+
**Easing**, in decision order:
|
|
112
|
+
|
|
113
|
+
| Situation | Easing |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| Entering or exiting | `ease-out` |
|
|
116
|
+
| Moving / morphing on screen | `ease-in-out` |
|
|
117
|
+
| Hover / color change | `ease` |
|
|
118
|
+
| Constant motion (marquee, progress) | `linear` |
|
|
119
|
+
| Default | `ease-out` |
|
|
120
|
+
|
|
121
|
+
**Never `ease-in` on UI.** It starts slow, delaying the exact moment the user is watching. `ease-out` at 200ms *feels* faster than `ease-in` at 200ms.
|
|
122
|
+
|
|
123
|
+
Built-in CSS easings are too weak. Use these:
|
|
124
|
+
|
|
125
|
+
```css
|
|
126
|
+
--ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* strong ease-out for UI */
|
|
127
|
+
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); /* strong ease-in-out for on-screen movement */
|
|
128
|
+
--ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); /* iOS-like drawer curve (Ionic) */
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Need a curve that isn't here? Take it from [easing.dev](https://easing.dev/) or [easings.co](https://easings.co/). Don't hand-roll one.
|
|
132
|
+
|
|
133
|
+
**Duration:**
|
|
134
|
+
|
|
135
|
+
| Element | Duration |
|
|
136
|
+
| --- | --- |
|
|
137
|
+
| Button press feedback | 100–160ms |
|
|
138
|
+
| Tooltips, small popovers | 125–200ms |
|
|
139
|
+
| Dropdowns, selects | 150–250ms |
|
|
140
|
+
| Modals, drawers | 200–500ms |
|
|
141
|
+
| Marketing / explanatory | Can be longer |
|
|
142
|
+
|
|
143
|
+
**UI animations stay under 300ms.** A 180ms dropdown feels more responsive than a 400ms one.
|
|
144
|
+
|
|
145
|
+
**Reach for a spring instead** when the motion is drag with momentum, an element that should feel alive, a gesture the user can interrupt or reverse, or decorative mouse-tracking:
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
{ type: "spring", duration: 0.5, bounce: 0.2 } // Apple-style — easier to reason about
|
|
149
|
+
{ type: "spring", mass: 1, stiffness: 100, damping: 10 } // traditional physics — more control
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Keep bounce at 0.1–0.3, and avoid bounce in most UI — reserve it for drag-to-dismiss and playful interactions.
|
|
153
|
+
|
|
154
|
+
### 6. Interruption and exit
|
|
155
|
+
|
|
156
|
+
- **Transitions, not keyframes, for anything triggered rapidly** — toasts, toggles, anything a user can fire twice in a second. Transitions retarget from the current value; keyframes restart from zero.
|
|
157
|
+
- **Springs for gestures**, because they carry velocity through an interruption.
|
|
158
|
+
- **Exit the way it entered.** A toast that slides in from the bottom leaves through the bottom. Symmetric paths are what make swipe-to-dismiss feel obvious.
|
|
159
|
+
- **Asymmetric timing where the user is deciding.** Slow on the deliberate phase (a hold-to-confirm press: 2s linear), snappy on the system response (release: 200ms ease-out).
|
|
160
|
+
|
|
161
|
+
### 7. Reduced motion and pointer gating
|
|
162
|
+
|
|
163
|
+
Ships with the animation, every time.
|
|
164
|
+
|
|
165
|
+
```css
|
|
166
|
+
@media (prefers-reduced-motion: reduce) {
|
|
167
|
+
.element { animation: fade 0.2s ease; } /* keep opacity/color, drop transform-based motion */
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@media (hover: hover) and (pointer: fine) {
|
|
171
|
+
.element:hover { transform: scale(1.05); } /* touch fires false hovers on tap */
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```jsx
|
|
176
|
+
const reduce = useReducedMotion();
|
|
177
|
+
const closedX = reduce ? 0 : '-100%';
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Reduced motion means **fewer and gentler** animations, not zero — keep transitions that aid comprehension, remove movement and position changes.
|
|
181
|
+
|
|
182
|
+
## Recipes
|
|
183
|
+
|
|
184
|
+
For ready-to-build implementations of the common cases — button press, dropdown, tooltip, modal, drawer, toast, accordion, stagger, hold-to-confirm, tab indicator, scroll reveal, drag-to-dismiss — see [references/recipes.md](references/recipes.md). Load it whenever the request matches one of those components; start from the recipe rather than from a blank file.
|
|
185
|
+
|
|
186
|
+
## Never Ship
|
|
187
|
+
|
|
188
|
+
Self-check before you finish. Each of these is an automatic block in `review-animations`:
|
|
189
|
+
|
|
190
|
+
| Never | Instead |
|
|
191
|
+
| --- | --- |
|
|
192
|
+
| `transition: all` | Name the exact properties |
|
|
193
|
+
| `transform: scale(0)` entrance | `scale(0.95)` + `opacity: 0` |
|
|
194
|
+
| `ease-in` on a UI element | `ease-out` or a strong custom curve |
|
|
195
|
+
| Built-in `ease-out` on a deliberate animation | `cubic-bezier(0.23, 1, 0.32, 1)` |
|
|
196
|
+
| Animation on a keyboard shortcut or 100+/day action | No animation |
|
|
197
|
+
| UI duration over 300ms with no reason | 150–250ms |
|
|
198
|
+
| `transform-origin: center` on a trigger-anchored popover | `var(--transform-origin)` (modals exempt) |
|
|
199
|
+
| Keyframes on toasts, toggles, rapidly-triggered elements | CSS transitions |
|
|
200
|
+
| Animating `width`/`height`/`margin`/`padding`/`top`/`left` | `transform` / `opacity` |
|
|
201
|
+
| Motion `x`/`y`/`scale` props under load | Full `transform` string |
|
|
202
|
+
| Ungated `:hover` motion | `@media (hover: hover) and (pointer: fine)` |
|
|
203
|
+
| Missing `prefers-reduced-motion` | Gentler variant, not zero |
|
|
204
|
+
| Everything entering at once | 30–80ms stagger |
|
|
205
|
+
|
|
206
|
+
## Output
|
|
207
|
+
|
|
208
|
+
Write the code. Then, in at most a few lines:
|
|
209
|
+
|
|
210
|
+
- **The gate result** — frequency tier and the named purpose. If something in the request was rejected, say which and why.
|
|
211
|
+
- **The ingredients** — tool, properties, curve, duration or spring config, in one line each.
|
|
212
|
+
- **What to feel-check** — if the result depends on feel you can't judge from code (a crossfade, a spring's bounce, the opacity/height balance in an entering list), say so and point at the check: play it at 2–5× duration or in the DevTools animation inspector, step it frame by frame, test gestures on a real device, and look again the next day with fresh eyes.
|
|
213
|
+
|
|
214
|
+
Don't pad this into a report. The code is the deliverable.
|
|
215
|
+
|
|
216
|
+
## Tone
|
|
217
|
+
|
|
218
|
+
Opinionated and brief. When the honest answer is "this shouldn't animate," give it — that answer is the reason this skill exists. When feel genuinely can't be settled from code, say so instead of guessing at a value.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Credit
|
|
223
|
+
|
|
224
|
+
Adapted for the rsc catalog from **[emilkowalski/skills](https://github.com/emilkowalski/skills)**
|
|
225
|
+
(MIT, commit `d23d7f8`) by Emil Kowalski — the design-engineering and animation philosophy behind
|
|
226
|
+
[Sonner](https://sonner.emilkowal.ski), [Vaul](https://vaul.emilkowal.ski) and
|
|
227
|
+
[animations.dev](https://animations.dev). The craft bar here is his; the routing, gates and evals
|
|
228
|
+
that make it an rsc skill are not. Nothing in this body is a substitute for his course.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
skill: animate
|
|
2
|
+
|
|
3
|
+
should_trigger:
|
|
4
|
+
- prompt: "Animate this dropdown so it opens smoothly — pick the right easing and duration."
|
|
5
|
+
why: "A build request for a named component's motion: the skill's core use case."
|
|
6
|
+
- prompt: "Add a transition when the modal opens and closes so it doesn't just pop in."
|
|
7
|
+
why: "Building an enter/exit animation, including the exit path the skill insists is symmetric."
|
|
8
|
+
- prompt: "Make this button feel responsive when you press it."
|
|
9
|
+
why: "Press feedback is a recipe in this skill; 'feel responsive' is its vocabulary."
|
|
10
|
+
- prompt: "I want a hold-to-delete button where the fill animates while you hold it."
|
|
11
|
+
why: "Hold-to-confirm is an explicit recipe (clip-path, 2s linear press, snappy release)."
|
|
12
|
+
- prompt: "Add motion to this toast so it slides in from the bottom and can be swiped away."
|
|
13
|
+
why: "Toast motion with a gesture: transitions over keyframes, symmetric exit, velocity dismissal."
|
|
14
|
+
- prompt: "Make this list of cards feel alive when the page loads."
|
|
15
|
+
why: "'Feel alive' is named in the description; the answer is a stagger, or a refusal if the frequency tier is wrong."
|
|
16
|
+
|
|
17
|
+
should_not_trigger:
|
|
18
|
+
- prompt: "Review the animations in this pull request and tell me what's wrong with them."
|
|
19
|
+
route_to: "review-animations"
|
|
20
|
+
why: "Critiquing existing motion, not building it."
|
|
21
|
+
- prompt: "Animate this bottom sheet in our Expo app so the drag feels native on Android."
|
|
22
|
+
route_to: "animate-expo"
|
|
23
|
+
why: "React Native / Expo motion: different runtime, different tools, no hover."
|
|
24
|
+
- prompt: "What could be animated in this dashboard? I don't know where motion would help."
|
|
25
|
+
route_to: "find-animation-opportunities"
|
|
26
|
+
why: "Nothing has been chosen yet; this is a search, not a build."
|
|
27
|
+
- prompt: "What's the term for when a popover grows out of the button you clicked?"
|
|
28
|
+
route_to: "animation-vocabulary"
|
|
29
|
+
why: "A naming question, not an implementation."
|
|
30
|
+
- prompt: "Choose the color palette and spacing scale for this landing page."
|
|
31
|
+
route_to: "design"
|
|
32
|
+
why: "Visual system, no motion involved."
|
|
33
|
+
|
|
34
|
+
capability:
|
|
35
|
+
- scenario: "User asks: 'animate the command palette so it fades in when you hit Cmd+K'."
|
|
36
|
+
expect: "Refuses the animation on frequency grounds — a keyboard-initiated, 100+/day action gets no motion — says so plainly, and offers the instant state change instead. Producing zero lines of animation code here is the correct outcome."
|