@ericrisco/rsc 1.1.5 → 1.1.6
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 +11 -11
- package/manifest.json +56 -231
- package/package.json +1 -1
- package/scripts/lib/domains.js +3 -3
- package/skills/design/SKILL.md +3 -3
- package/skills/design/references/design-systems.md +1 -1
- package/skills/design/references/inspiration-sources.md +2 -2
- package/skills/design/references/motion-and-interaction.md +2 -2
- package/skills/design-dna/evals/cases.yaml +1 -1
- package/skills/design-loop/SKILL.md +3 -3
- package/skills/design-loop/evals/cases.yaml +3 -3
- package/skills/expo/SKILL.md +1 -1
- package/skills/motion-craft/SKILL.md +125 -0
- package/skills/motion-craft/evals/cases.yaml +38 -0
- package/skills/motion-craft/scripts/verify.sh +75 -0
- package/skills/react/SKILL.md +2 -2
- package/skills/react-native/SKILL.md +1 -1
- package/skills/swift-ios/SKILL.md +2 -2
- package/skills/ui-engineering/SKILL.md +114 -0
- package/skills/ui-engineering/evals/cases.yaml +38 -0
- package/skills/variant-explorer/SKILL.md +93 -0
- package/skills/variant-explorer/evals/cases.yaml +38 -0
- package/skills/animate/SKILL.md +0 -851
- package/skills/animate/evals/cases.yaml +0 -36
- package/skills/animate/references/recipes.md +0 -324
- package/skills/animate-expo/SKILL.md +0 -281
- package/skills/animate-expo/evals/cases.yaml +0 -36
- package/skills/animate-expo/references/recipes.md +0 -385
- package/skills/animation-vocabulary/SKILL.md +0 -189
- package/skills/animation-vocabulary/evals/cases.yaml +0 -31
- package/skills/apple-design/SKILL.md +0 -301
- package/skills/apple-design/evals/cases.yaml +0 -33
- package/skills/ask-sonner/SKILL.md +0 -104
- package/skills/ask-sonner/evals/cases.yaml +0 -33
- package/skills/ask-sonner/references/api.md +0 -64
- package/skills/design-eng/SKILL.md +0 -88
- package/skills/design-eng/evals/cases.yaml +0 -36
- package/skills/find-animation-opportunities/SKILL.md +0 -150
- package/skills/find-animation-opportunities/evals/cases.yaml +0 -31
- package/skills/improve-animations/SKILL.md +0 -126
- package/skills/improve-animations/evals/cases.yaml +0 -31
- package/skills/improve-animations/references/audit.md +0 -115
- package/skills/improve-animations/references/plan-template.md +0 -73
- package/skills/pick-ui-library/SKILL.md +0 -101
- package/skills/pick-ui-library/evals/cases.yaml +0 -33
- package/skills/pick-ui-library/references/component-galleries.md +0 -59
- package/skills/prototype/SKILL.md +0 -113
- package/skills/prototype/evals/cases.yaml +0 -31
- package/skills/prototype/references/picker.md +0 -197
- package/skills/review-animations/SKILL.md +0 -188
- package/skills/review-animations/evals/cases.yaml +0 -34
- package/skills/review-animations/references/standards.md +0 -187
- package/skills/review-animations/scripts/verify.sh +0 -164
- package/skills/write-swift/SKILL.md +0 -413
- package/skills/write-swift/evals/cases.yaml +0 -36
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: review-animations
|
|
3
|
-
description: "Review, critique or grade existing animation and motion code against a strict craft bar — easing, duration, transform-origin, interruptibility, GPU-only properties, reduced motion, enter/exit asymmetry, stagger. Default is to flag; approval is earned. Use on the transitions in a diff or a component."
|
|
4
|
-
tags: [motion, animation, review, craft, ui]
|
|
5
|
-
recommends: [animate, improve-animations, code-review]
|
|
6
|
-
profiles: [full]
|
|
7
|
-
origin: emilkowalski (MIT, adapted)
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Reviewing Animations
|
|
11
|
-
|
|
12
|
-
**Hand-offs.** Reviewing a whole codebase's motion, and writing plans another agent can execute, is
|
|
13
|
-
`../improve-animations/SKILL.md`'s — this skill's object is **one diff or one component**. Finding
|
|
14
|
-
motion that is *missing* is `../find-animation-opportunities/SKILL.md`'s. General code review is
|
|
15
|
-
`../code-review/SKILL.md`'s; decline non-motion code and point there.
|
|
16
|
-
|
|
17
|
-
**The countable half of this bar is executable.** `scripts/verify.sh` in this skill carries the tell
|
|
18
|
-
registry — `transition: all`, a `scale(0)` entrance, `ease-in` on UI, a centered popover origin, a
|
|
19
|
-
layout-property transition, the Motion `x`/`y`/`scale` shorthands, and motion with no reduced-motion
|
|
20
|
-
guard anywhere. Run it first (`bash scripts/verify.sh`, add `--strict` to fail on warnings), then
|
|
21
|
-
spend your judgement on what it cannot see: frequency tier, purpose, cohesion, and whether the thing
|
|
22
|
-
feels right. A finding the script already made is not a finding you discovered.
|
|
23
|
-
|
|
24
|
-
A specialized review skill. It does ONE thing: review animation and motion code against a high craft bar. It does not write features, fix unrelated bugs, or review non-motion code. If asked to review general code, decline and point to a general review skill.
|
|
25
|
-
|
|
26
|
-
## Operating Posture
|
|
27
|
-
|
|
28
|
-
You are a senior design engineer with a brutal eye for craft. Your bias is toward **motion that feels right**, not motion that merely runs. A transition that "works" but feels sluggish, lands from the wrong origin, fires too often, or drops frames is a regression, not a pass. Default to flagging. Approval is earned, not assumed.
|
|
29
|
-
|
|
30
|
-
The substantive bar comes from Emil Kowalski's animation philosophy (animations.dev). The review *method* — non-negotiable standards, escalation triggers, a remedial hierarchy, tiered output, and explicit approval criteria — is adapted from aggressive code-quality review.
|
|
31
|
-
|
|
32
|
-
For the full rule catalog (easing curves, duration tables, spring config, gestures, clip-path, performance, a11y), see [references/standards.md](references/standards.md). Load it whenever a finding needs a precise value or citation.
|
|
33
|
-
|
|
34
|
-
## The Ten Non-Negotiable Standards
|
|
35
|
-
|
|
36
|
-
Every animation in the diff is measured against these. A violation is a finding.
|
|
37
|
-
|
|
38
|
-
1. **Justified motion.** Every animation must answer "why does this animate?" — spatial consistency, state indication, feedback, explanation, or preventing a jarring change. "It looks cool" on a frequently-seen element is a block.
|
|
39
|
-
|
|
40
|
-
2. **Frequency-appropriate.** Match motion to how often it's seen. Keyboard-initiated and 100+/day actions get **no** animation. Tens/day gets reduced motion. Occasional gets standard. Rare/first-time can have delight.
|
|
41
|
-
|
|
42
|
-
3. **Responsive easing.** Entering/exiting elements use `ease-out` or a strong custom curve. `ease-in` on UI is a block — it delays the moment the user watches most. Built-in CSS easings are too weak; expect custom cubic-beziers.
|
|
43
|
-
|
|
44
|
-
4. **Sub-300ms UI.** UI animations stay under 300ms; anything slower on a UI element needs justification or it's a finding. Per-element budgets live in [references/standards.md](references/standards.md).
|
|
45
|
-
|
|
46
|
-
5. **Origin & physical correctness.** Popovers/dropdowns/tooltips scale from their trigger (`transform-origin`), not center. Never animate from `scale(0)` — start from `scale(0.9–0.97)` + opacity (Modals are exempt — they stay centered.)
|
|
47
|
-
|
|
48
|
-
6. **Interruptibility.** Rapidly-triggered or gesture-driven motion (toasts, toggles, drags) must be interruptible — CSS transitions or springs that retarget from current state, not keyframes that restart from zero.
|
|
49
|
-
|
|
50
|
-
7. **GPU-only properties.** Animate `transform` and `opacity` only. Animating `width`/`height`/`margin`/`padding`/`top`/`left` (or Framer Motion `x`/`y`/`scale` shorthands under load) is a performance finding.
|
|
51
|
-
|
|
52
|
-
8. **Accessibility.** `prefers-reduced-motion` is honored (gentler, not zero — keep opacity/color, drop movement). Hover animations are gated behind `@media (hover: hover) and (pointer: fine)`.
|
|
53
|
-
|
|
54
|
-
9. **Asymmetric enter/exit.** Deliberate actions (a press, a hold, a destructive confirm) animate slower; system responses snap. Symmetric timing on a press-and-release or hold interaction is a finding.
|
|
55
|
-
|
|
56
|
-
10. **Cohesion.** Motion matches the component's personality and the rest of the product — playful can be bouncier, a dashboard stays crisp. Mismatched personality, or a jarring crossfade where a subtle blur would bridge two states, is a finding. When unsure whether motion feels right, the strongest move is often to delete it.
|
|
57
|
-
|
|
58
|
-
## Aggressive Escalation Triggers
|
|
59
|
-
|
|
60
|
-
Flag these on sight, hard:
|
|
61
|
-
|
|
62
|
-
- `transition: all` (unbounded property animation)
|
|
63
|
-
- `scale(0)` or pure-fade entrances with no initial transform
|
|
64
|
-
- `ease-in` on any UI interaction; weak built-in easing on a deliberate animation
|
|
65
|
-
- Animation on a keyboard shortcut, command-palette toggle, or 100+/day action
|
|
66
|
-
- UI duration > 300ms with no stated reason
|
|
67
|
-
- `transform-origin: center` on a trigger-anchored popover/dropdown/tooltip
|
|
68
|
-
- Keyframes on toasts, toggles, or anything added/triggered rapidly
|
|
69
|
-
- Animating layout properties (`width`/`height`/`margin`/`padding`/`top`/`left`)
|
|
70
|
-
- Framer Motion `x`/`y`/`scale` props on motion that runs while the page is busy
|
|
71
|
-
- Updating a CSS variable on a parent to drive a child transform (style recalc storm)
|
|
72
|
-
- Missing `prefers-reduced-motion` handling on movement
|
|
73
|
-
- Ungated `:hover` motion
|
|
74
|
-
- Symmetric enter/exit timing on a press-and-release or hold interaction
|
|
75
|
-
- Everything-at-once entrance where a 30–80ms stagger belongs
|
|
76
|
-
|
|
77
|
-
## Remedial Preference Hierarchy
|
|
78
|
-
|
|
79
|
-
When proposing fixes, prefer earlier moves over later ones:
|
|
80
|
-
|
|
81
|
-
1. **Delete the animation** (high-frequency / no purpose / keyboard-triggered).
|
|
82
|
-
2. **Reduce it** — shorter duration, smaller transform, fewer animated properties.
|
|
83
|
-
3. **Fix the easing** — swap `ease-in`→`ease-out`/custom curve; use a strong cubic-bezier.
|
|
84
|
-
4. **Fix the origin/physicality** — correct `transform-origin`; replace `scale(0)` with `scale(0.95)`+opacity.
|
|
85
|
-
5. **Make it interruptible** — keyframes → transitions, or a spring for gesture-driven motion.
|
|
86
|
-
6. **Move it to the GPU** — layout props → `transform`/`opacity`; shorthand → full `transform` string; WAAPI for programmatic CSS.
|
|
87
|
-
7. **Asymmetric timing** — slow the deliberate phase, snap the response.
|
|
88
|
-
8. **Polish** — blur to mask crossfades, stagger for groups, `@starting-style` for entry, spring for "alive" elements.
|
|
89
|
-
9. **Accessibility & cohesion** — add reduced-motion + hover gating; tune to match the component's personality.
|
|
90
|
-
|
|
91
|
-
## Required Output Format
|
|
92
|
-
|
|
93
|
-
Two parts, in this order.
|
|
94
|
-
|
|
95
|
-
### Part 1 — Findings table (REQUIRED)
|
|
96
|
-
|
|
97
|
-
A single markdown table. One row per issue. Never a "Before:/After:" list.
|
|
98
|
-
|
|
99
|
-
| Before | After | Why |
|
|
100
|
-
| --- | --- | --- |
|
|
101
|
-
| `transition: all 300ms` | `transition: transform 200ms ease-out` | Specify exact properties; `all` animates unintended properties off-GPU |
|
|
102
|
-
| `transform: scale(0)` | `transform: scale(0.95); opacity: 0` | Nothing appears from nothing — `scale(0)` looks like it came from nowhere |
|
|
103
|
-
| `ease-in` on dropdown | `ease-out` + custom curve | `ease-in` delays the moment the user watches most; feels sluggish |
|
|
104
|
-
| `transform-origin: center` on popover | `var(--transform-origin)` (Base UI) | Popovers scale from their trigger, not center (modals are exempt) |
|
|
105
|
-
|
|
106
|
-
### Part 2 — Verdict (REQUIRED)
|
|
107
|
-
|
|
108
|
-
Group remaining commentary by impact tier, highest first. Omit empty tiers.
|
|
109
|
-
|
|
110
|
-
1. **Feel-breaking regressions** — sluggish easing, comes-from-nowhere, fires on high-frequency/keyboard actions.
|
|
111
|
-
2. **Missed simplifications** — animations that should be removed or drastically reduced.
|
|
112
|
-
3. **Performance** — non-GPU properties, dropped-frame risks, recalc storms.
|
|
113
|
-
4. **Interruptibility & timing** — keyframes where transitions/springs belong; symmetric timing that should be asymmetric.
|
|
114
|
-
5. **Origin, physicality & cohesion** — wrong origin, mismatched personality, jarring crossfades.
|
|
115
|
-
6. **Accessibility** — reduced-motion and pointer/hover gating.
|
|
116
|
-
|
|
117
|
-
Close with an explicit decision:
|
|
118
|
-
|
|
119
|
-
- **Block** — any feel-breaking regression, animation on a keyboard/high-frequency action, `scale(0)`/`ease-in` on UI, or a non-GPU animation with an easy GPU fix.
|
|
120
|
-
- **Approve** — no feel-breaking regressions, no obvious motion that should be deleted, durations and easing within bounds, interruptibility handled where needed, reduced-motion respected.
|
|
121
|
-
|
|
122
|
-
Be specific and cite `file:line`. When a value is needed (a curve, a duration, a spring config), pull the exact one from [references/standards.md](references/standards.md) rather than approximating.
|
|
123
|
-
|
|
124
|
-
## Guidelines
|
|
125
|
-
|
|
126
|
-
- Prefer CSS transitions/`@starting-style`/WAAPI for predetermined motion; JS/springs for dynamic, interruptible, gesture-driven motion.
|
|
127
|
-
- When unsure whether motion feels right, recommend reviewing it in slow motion / frame-by-frame and with fresh eyes the next day rather than guessing.
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Credit
|
|
132
|
-
|
|
133
|
-
Adapted for the rsc catalog from **[emilkowalski/skills](https://github.com/emilkowalski/skills)**
|
|
134
|
-
(MIT, commit `d23d7f8`) by Emil Kowalski — the design-engineering and animation philosophy behind
|
|
135
|
-
[Sonner](https://sonner.emilkowal.ski), [Vaul](https://vaul.emilkowal.ski) and
|
|
136
|
-
[animations.dev](https://animations.dev). The craft bar here is his; the routing, gates and evals
|
|
137
|
-
that make it an rsc skill are not. Nothing in this body is a substitute for his course.
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
# Craft reference, inherited from the umbrella
|
|
141
|
-
|
|
142
|
-
*Moved here from `design-eng` (spec: `design-area-cleanup`), which routes and no longer teaches.
|
|
143
|
-
This is the same material by the same author; where it overlaps a rule stated above, the above is
|
|
144
|
-
the summary and this is the reasoning.*
|
|
145
|
-
|
|
146
|
-
## Review Format (Required)
|
|
147
|
-
|
|
148
|
-
When reviewing UI code, you MUST use a markdown table with Before/After columns. Do NOT use a list with "Before:" and "After:" on separate lines. Always output an actual markdown table like this:
|
|
149
|
-
|
|
150
|
-
| Before | After | Why |
|
|
151
|
-
| --- | --- | --- |
|
|
152
|
-
| `transition: all 300ms` | `transition: transform 200ms ease-out` | Specify exact properties; avoid `all` |
|
|
153
|
-
| `transform: scale(0)` | `transform: scale(0.95); opacity: 0` | Nothing in the real world appears from nothing |
|
|
154
|
-
| `ease-in` on dropdown | `ease-out` with custom curve | `ease-in` feels sluggish; `ease-out` gives instant feedback |
|
|
155
|
-
| No `:active` state on button | `transform: scale(0.97)` on `:active` | Buttons must feel responsive to press |
|
|
156
|
-
| `transform-origin: center` on popover | `transform-origin: var(--transform-origin)` | Popovers should scale from their trigger (not modals — modals stay centered) |
|
|
157
|
-
|
|
158
|
-
Wrong format (never do this):
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
Before: transition: all 300ms
|
|
162
|
-
After: transition: transform 200ms ease-out
|
|
163
|
-
────────────────────────────
|
|
164
|
-
Before: scale(0)
|
|
165
|
-
After: scale(0.95)
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
Correct format: A single markdown table with | Before | After | Why | columns, one row per issue found. The "Why" column briefly explains the reasoning.
|
|
169
|
-
|
|
170
|
-
## Review Checklist
|
|
171
|
-
|
|
172
|
-
When reviewing UI code, check for:
|
|
173
|
-
|
|
174
|
-
| Issue | Fix |
|
|
175
|
-
| ------------------------------------------ | ---------------------------------------------------------------- |
|
|
176
|
-
| `transition: all` | Specify exact properties: `transition: transform 200ms ease-out` |
|
|
177
|
-
| `scale(0)` entry animation | Start from `scale(0.95)` with `opacity: 0` |
|
|
178
|
-
| `ease-in` on UI element | Switch to `ease-out` or custom curve |
|
|
179
|
-
| `transform-origin: center` on popover | Set to trigger location or use Base UI's `var(--transform-origin)` (modals are exempt — keep centered) |
|
|
180
|
-
| Animation on keyboard action | Remove animation entirely |
|
|
181
|
-
| Duration > 300ms on UI element | Reduce to 150-250ms |
|
|
182
|
-
| Hover animation without media query | Add `@media (hover: hover) and (pointer: fine)` |
|
|
183
|
-
| Keyframes on rapidly-triggered element | Use CSS transitions for interruptibility |
|
|
184
|
-
| Framer Motion `x`/`y` props under load | Use `transform: "translateX()"` for hardware acceleration |
|
|
185
|
-
| Same enter/exit transition speed | Make exit faster than enter (e.g., enter 2s, exit 200ms) |
|
|
186
|
-
| Elements all appear at once | Add stagger delay (30-80ms between items) |
|
|
187
|
-
|
|
188
|
-
---
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
skill: review-animations
|
|
2
|
-
|
|
3
|
-
should_trigger:
|
|
4
|
-
- prompt: "Review the animations in this pull request and tell me what's wrong with them."
|
|
5
|
-
why: "Reviewing motion in a diff: the skill's core object."
|
|
6
|
-
- prompt: "Is the easing and duration on this modal transition right?"
|
|
7
|
-
why: "A judgement call against the easing and duration standards."
|
|
8
|
-
- prompt: "Check this component's motion against a strict craft bar before I merge it."
|
|
9
|
-
why: "The bar and the merge gate are what this skill provides."
|
|
10
|
-
- prompt: "Critique the transitions I just wrote — be harsh."
|
|
11
|
-
why: "Default-to-flagging posture; approval is earned."
|
|
12
|
-
- prompt: "Did I get the transform-origin and the reduced-motion handling right on this popover?"
|
|
13
|
-
why: "Two of the ten non-negotiable standards, named directly."
|
|
14
|
-
|
|
15
|
-
should_not_trigger:
|
|
16
|
-
- prompt: "Audit the animations across the whole app and give me a prioritized roadmap of fixes."
|
|
17
|
-
route_to: "improve-animations"
|
|
18
|
-
why: "Whole-codebase audit producing plans, not a verdict on one diff."
|
|
19
|
-
- prompt: "Animate this dropdown for me with the right curve and duration."
|
|
20
|
-
route_to: "animate"
|
|
21
|
-
why: "Building the animation, not reviewing one."
|
|
22
|
-
- prompt: "Review this pull request for SQL injection and missing authorization checks."
|
|
23
|
-
route_to: "code-review"
|
|
24
|
-
why: "Non-motion code review; this skill declines and points there."
|
|
25
|
-
- prompt: "What could be animated in this settings page that isn't animated today?"
|
|
26
|
-
route_to: "find-animation-opportunities"
|
|
27
|
-
why: "Looking for absent motion, not judging present motion."
|
|
28
|
-
- prompt: "Pick a library for the command palette instead of the div-based one we have."
|
|
29
|
-
route_to: "pick-ui-library"
|
|
30
|
-
why: "A dependency choice, not a motion review."
|
|
31
|
-
|
|
32
|
-
capability:
|
|
33
|
-
- scenario: "A diff adds `transition: all 400ms ease-in` and a `transform: scale(0)` entrance to a popover with `transform-origin: center`, and no reduced-motion handling anywhere in the project."
|
|
34
|
-
expect: "Runs scripts/verify.sh first so the countable findings come from the checker (transition-all, ease-in-ui, scale-zero-entrance, origin-center-popover, reduced-motion-missing) and spends judgement on frequency, purpose and cohesion. Blocks rather than approves, and every finding carries the exact replacement value."
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
# Animation Standards Reference
|
|
2
|
-
|
|
3
|
-
The precise values, curves, and rules behind the review. Cite these in findings instead of approximating. Distilled from Emil Kowalski's design engineering philosophy.
|
|
4
|
-
|
|
5
|
-
## Should it animate? (frequency table)
|
|
6
|
-
|
|
7
|
-
| Frequency | Decision |
|
|
8
|
-
| --- | --- |
|
|
9
|
-
| 100+ times/day (keyboard shortcuts, command palette toggle) | No animation. Ever. |
|
|
10
|
-
| Tens of times/day (hover effects, list navigation) | Remove or drastically reduce |
|
|
11
|
-
| Occasional (modals, drawers, toasts) | Standard animation |
|
|
12
|
-
| Rare / first-time (onboarding, feedback, celebrations) | Can add delight |
|
|
13
|
-
|
|
14
|
-
**Never animate keyboard-initiated actions** — they repeat hundreds of times daily; animation makes them feel slow and disconnected. (Raycast has no open/close animation — correct for something used hundreds of times a day.)
|
|
15
|
-
|
|
16
|
-
Valid purposes for motion: spatial consistency, state indication, explanation, feedback, preventing jarring change. "It looks cool" on a frequently-seen element is not valid.
|
|
17
|
-
|
|
18
|
-
## Easing
|
|
19
|
-
|
|
20
|
-
Decision order:
|
|
21
|
-
- Entering or exiting → **`ease-out`** (starts fast, feels responsive)
|
|
22
|
-
- Moving / morphing on screen → **`ease-in-out`**
|
|
23
|
-
- Hover / color change → **`ease`**
|
|
24
|
-
- Constant motion (marquee, progress) → **`linear`**
|
|
25
|
-
- Default → **`ease-out`**
|
|
26
|
-
|
|
27
|
-
**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.
|
|
28
|
-
|
|
29
|
-
Built-in CSS easings are too weak. Use strong custom curves:
|
|
30
|
-
|
|
31
|
-
```css
|
|
32
|
-
--ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* strong ease-out for UI */
|
|
33
|
-
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); /* strong ease-in-out for on-screen movement */
|
|
34
|
-
--ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); /* iOS-like drawer curve (Ionic) */
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Find curves at [easing.dev](https://easing.dev/) or [easings.co](https://easings.co/) — don't hand-roll from scratch.
|
|
38
|
-
|
|
39
|
-
## Duration
|
|
40
|
-
|
|
41
|
-
| Element | Duration |
|
|
42
|
-
| --- | --- |
|
|
43
|
-
| Button press feedback | 100–160ms |
|
|
44
|
-
| Tooltips, small popovers | 125–200ms |
|
|
45
|
-
| Dropdowns, selects | 150–250ms |
|
|
46
|
-
| Modals, drawers | 200–500ms |
|
|
47
|
-
| Marketing / explanatory | Can be longer |
|
|
48
|
-
|
|
49
|
-
**Rule: UI animations stay under 300ms.** A 180ms dropdown feels more responsive than a 400ms one. Faster spinners make load feel faster (same actual time). Instant tooltips after the first (skip delay + animation) make a toolbar feel faster.
|
|
50
|
-
|
|
51
|
-
## Physicality
|
|
52
|
-
|
|
53
|
-
- **Never `scale(0)`.** Start from `scale(0.9–0.97)` + `opacity: 0`. Nothing in the real world appears from nothing.
|
|
54
|
-
- **Origin-aware popovers.** Scale from the trigger, not center:
|
|
55
|
-
```css
|
|
56
|
-
.popover { transform-origin: var(--transform-origin); } /* Base UI */
|
|
57
|
-
```
|
|
58
|
-
**Modals are exempt** — they appear centered in the viewport, keep `transform-origin: center`.
|
|
59
|
-
- **Button press feedback.** `transform: scale(0.97)` on `:active`, `transition: transform 160ms ease-out`. Subtle (0.95–0.98). Applies to any pressable element.
|
|
60
|
-
|
|
61
|
-
## Springs
|
|
62
|
-
|
|
63
|
-
Feel natural because they simulate physics; no fixed duration — they settle on parameters. Use for: drag with momentum, "alive" elements (Dynamic Island), interruptible gestures, decorative mouse-tracking.
|
|
64
|
-
|
|
65
|
-
```js
|
|
66
|
-
// Apple-style (easier to reason about) — recommended
|
|
67
|
-
{ type: "spring", duration: 0.5, bounce: 0.2 }
|
|
68
|
-
|
|
69
|
-
// Traditional physics (more control)
|
|
70
|
-
{ type: "spring", mass: 1, stiffness: 100, damping: 10 }
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Keep bounce subtle (0.1–0.3); avoid bounce in most UI — reserve for drag-to-dismiss and playful interactions. Springs maintain velocity when interrupted (keyframes restart from zero), so they're ideal for gestures users may reverse mid-motion.
|
|
74
|
-
|
|
75
|
-
Mouse interactions: interpolate with `useSpring` rather than tying value directly to mouse position (direct = artificial, no momentum). Only do this when the motion is decorative.
|
|
76
|
-
|
|
77
|
-
## Interruptibility
|
|
78
|
-
|
|
79
|
-
CSS **transitions** can be interrupted and retargeted mid-animation; **keyframes** restart from zero. For anything triggered rapidly (toasts being added, toggles), transitions are smoother.
|
|
80
|
-
|
|
81
|
-
```css
|
|
82
|
-
/* Interruptible — good for dynamic UI */
|
|
83
|
-
.toast { transition: transform 400ms ease; }
|
|
84
|
-
|
|
85
|
-
/* Not interruptible — avoid for dynamic UI */
|
|
86
|
-
@keyframes slideIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Use `@starting-style` for entry without JS:
|
|
90
|
-
|
|
91
|
-
```css
|
|
92
|
-
.toast {
|
|
93
|
-
opacity: 1; transform: translateY(0);
|
|
94
|
-
transition: opacity 400ms ease, transform 400ms ease;
|
|
95
|
-
@starting-style { opacity: 0; transform: translateY(100%); }
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
Legacy fallback: `useEffect(() => setMounted(true), [])` + `data-mounted` attribute.
|
|
100
|
-
|
|
101
|
-
## Asymmetric timing
|
|
102
|
-
|
|
103
|
-
Slow where the user is deciding, fast where the system responds.
|
|
104
|
-
|
|
105
|
-
```css
|
|
106
|
-
.overlay { transition: clip-path 200ms ease-out; } /* release: fast */
|
|
107
|
-
.button:active .overlay { transition: clip-path 2s linear; } /* press: slow, deliberate */
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Performance
|
|
111
|
-
|
|
112
|
-
- **Only animate `transform` and `opacity`** — they skip layout/paint and run on the GPU. `padding`/`margin`/`height`/`width`/`top`/`left` trigger all three rendering steps.
|
|
113
|
-
- **Don't drive child transforms via a CSS variable on the parent** — it recalcs styles for all children. Set `transform` directly on the element.
|
|
114
|
-
```js
|
|
115
|
-
element.style.setProperty('--swipe-amount', `${d}px`); // bad: recalc on all children
|
|
116
|
-
element.style.transform = `translateY(${d}px)`; // good: only this element
|
|
117
|
-
```
|
|
118
|
-
- **Framer Motion shorthands are NOT hardware-accelerated.** `x`/`y`/`scale` run on the main thread via rAF and drop frames under load. Use the full transform string:
|
|
119
|
-
```jsx
|
|
120
|
-
<motion.div animate={{ x: 100 }} /> // drops frames under load
|
|
121
|
-
<motion.div animate={{ transform: "translateX(100px)" }} /> // hardware accelerated
|
|
122
|
-
```
|
|
123
|
-
- **CSS animations beat JS under load** — they run off the main thread; rAF-based animations stutter while the browser loads/scripts/paints. Use CSS for predetermined motion, JS for dynamic/interruptible.
|
|
124
|
-
- **WAAPI** gives JS control with CSS performance (hardware-accelerated, interruptible, no library):
|
|
125
|
-
```js
|
|
126
|
-
element.animate([{ clipPath: 'inset(0 0 100% 0)' }, { clipPath: 'inset(0 0 0 0)' }],
|
|
127
|
-
{ duration: 1000, fill: 'forwards', easing: 'cubic-bezier(0.77, 0, 0.175, 1)' });
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Transforms & clip-path
|
|
131
|
-
|
|
132
|
-
- **`translate` percentages** are relative to the element's own size — `translateY(100%)` moves by the element's height regardless of dimensions (how Sonner/Vaul position toasts/drawers). Prefer over hardcoded px.
|
|
133
|
-
- **`scale()` scales children too** (font, icons, content) — a feature for press feedback.
|
|
134
|
-
- **3D**: `rotateX/Y` + `transform-style: preserve-3d` for depth/orbit/flip without JS.
|
|
135
|
-
- **`clip-path: inset(t r b l)`** is a powerful animation tool: each value eats in from that side. Uses: reveal-on-scroll (`inset(0 0 100% 0)` → `inset(0 0 0 0)`), hold-to-delete overlay, seamless tab color transitions (duplicate + clip the active copy), comparison sliders.
|
|
136
|
-
|
|
137
|
-
## Gestures & drag
|
|
138
|
-
|
|
139
|
-
- **Momentum dismissal**: don't require crossing a distance threshold — compute velocity (`Math.abs(distance)/elapsedMs`); dismiss if `> ~0.11`. A flick should be enough.
|
|
140
|
-
- **Damping at boundaries**: dragging past a natural edge moves less the further you go (real things slow before stopping).
|
|
141
|
-
- **Pointer capture** once dragging starts, so it continues when the pointer leaves bounds.
|
|
142
|
-
- **Multi-touch protection**: ignore extra touch points after the drag begins (`if (isDragging) return`) — prevents jumps.
|
|
143
|
-
- **Friction over hard stops** — allow over-drag with rising resistance rather than an invisible wall.
|
|
144
|
-
|
|
145
|
-
## Masking imperfect crossfades
|
|
146
|
-
|
|
147
|
-
When a crossfade shows two overlapping states despite tuning easing/duration, add subtle `filter: blur(2px)` during the transition to blend them into one perceived transformation. Keep blur < 20px (heavy blur is expensive, especially Safari).
|
|
148
|
-
|
|
149
|
-
## Stagger
|
|
150
|
-
|
|
151
|
-
Stagger group entrances; 30–80ms between items. Longer delays feel slow. Stagger is decorative — never block interaction while it plays.
|
|
152
|
-
|
|
153
|
-
```css
|
|
154
|
-
.item { opacity: 0; transform: translateY(8px); animation: fadeIn 300ms ease-out forwards; }
|
|
155
|
-
.item:nth-child(2) { animation-delay: 50ms; }
|
|
156
|
-
.item:nth-child(3) { animation-delay: 100ms; }
|
|
157
|
-
@keyframes fadeIn { to { opacity: 1; transform: translateY(0); } }
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## Accessibility
|
|
161
|
-
|
|
162
|
-
```css
|
|
163
|
-
@media (prefers-reduced-motion: reduce) {
|
|
164
|
-
.element { animation: fade 0.2s ease; } /* keep opacity/color, drop transform-based motion */
|
|
165
|
-
}
|
|
166
|
-
@media (hover: hover) and (pointer: fine) {
|
|
167
|
-
.element:hover { transform: scale(1.05); } /* gate hover motion — touch fires false hovers on tap */
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
```jsx
|
|
172
|
-
const reduce = useReducedMotion();
|
|
173
|
-
const closedX = reduce ? 0 : '-100%';
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Reduced motion means fewer and gentler animations, not zero — keep transitions that aid comprehension, remove movement/position changes.
|
|
177
|
-
|
|
178
|
-
## Debugging (recommend in reviews when feel is uncertain)
|
|
179
|
-
|
|
180
|
-
- **Slow motion**: bump duration 2–5× or use DevTools animation inspector. Check colors crossfade cleanly, easing doesn't stop abruptly, `transform-origin` is right, coordinated properties stay in sync.
|
|
181
|
-
- **Frame-by-frame**: Chrome DevTools Animations panel reveals timing drift between coordinated properties.
|
|
182
|
-
- **Real devices** for gestures (drawers, swipe) — connect a phone, hit the dev server by IP, use Safari remote devtools.
|
|
183
|
-
- **Fresh eyes next day** — imperfections invisible during development surface later.
|
|
184
|
-
|
|
185
|
-
## Cohesion
|
|
186
|
-
|
|
187
|
-
Match motion to the component's personality: playful can be bouncier; a professional dashboard should be crisp and fast. Sonner feels right partly because easing, duration, design, and even the name are in harmony — slightly slower, `ease` rather than `ease-out`, to feel elegant. Opacity + height in entering/exiting lists is trial and error; there's no formula — adjust until it feels right.
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# verify.sh — the checkable half of the motion craft bar.
|
|
4
|
-
#
|
|
5
|
-
# WHAT THIS IS
|
|
6
|
-
# The source material for these skills (emilkowalski/skills, MIT) ships its "Never Ship" bar as
|
|
7
|
-
# a markdown table: prose an agent may or may not honor. Part of that bar is a plain pattern in
|
|
8
|
-
# the code — `transition: all`, an entrance from `scale(0)`, `ease-in` on a UI transition — and
|
|
9
|
-
# anything that is a pattern belongs in a binary, not in a paragraph (constitution P1).
|
|
10
|
-
#
|
|
11
|
-
# So this script owns the countable half, and the SKILL.md bodies own the half that needs
|
|
12
|
-
# judgement (is the frequency tier right? does the motion have a purpose? does it feel right?).
|
|
13
|
-
# Nothing here can tell you whether an animation feels good. It tells you when it is definitely
|
|
14
|
-
# wrong.
|
|
15
|
-
#
|
|
16
|
-
# WHAT IT CHECKS
|
|
17
|
-
# - the tell registry: one row per checkable motion defect, iterated generically — see
|
|
18
|
-
# motion_tell_table(). Every row has a fixture in tests/fixtures/motion-tells/ and is driven
|
|
19
|
-
# from tests/motion-tells.test.js; a row without a fixture fails the suite.
|
|
20
|
-
# - one counter that cannot be a row: motion present with no prefers-reduced-motion guard
|
|
21
|
-
# anywhere. Absence of a guard is not a pattern match, so it gets its own check and its own
|
|
22
|
-
# named test.
|
|
23
|
-
#
|
|
24
|
-
# HOW TO RUN (inside YOUR project, not the skills repo)
|
|
25
|
-
# bash verify.sh # fail-severity rows break the build; warns are advisory
|
|
26
|
-
# bash verify.sh --strict # treat warnings as failures too
|
|
27
|
-
#
|
|
28
|
-
# EXIT CODES
|
|
29
|
-
# 0 no fail-severity finding (and no warning, under --strict)
|
|
30
|
-
# 1 a fail-severity finding, or --strict with any warning
|
|
31
|
-
# 2 bad usage
|
|
32
|
-
#
|
|
33
|
-
# Missing tools are SKIPPED with a notice, never failed.
|
|
34
|
-
|
|
35
|
-
set -euo pipefail
|
|
36
|
-
|
|
37
|
-
# --- portability: runs on stock macOS bash 3.2 ------------------------------
|
|
38
|
-
# No mapfile, no associative arrays, no `${arr[@]}` under set -u — same constraint as design's
|
|
39
|
-
# verify.sh, for the same reason: the default /bin/bash on macOS is 3.2.
|
|
40
|
-
if [ -z "${BASH_VERSION:-}" ]; then
|
|
41
|
-
printf 'This script requires bash (any version >= 3.2). Run: bash %s\n' "$0" >&2
|
|
42
|
-
exit 2
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
STRICT=0
|
|
46
|
-
while [ "$#" -gt 0 ]; do
|
|
47
|
-
case "$1" in
|
|
48
|
-
--strict) STRICT=1; shift ;;
|
|
49
|
-
-h|--help) sed -n '2,32p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
|
50
|
-
*) printf 'unknown argument: %s\n' "$1" >&2; exit 2 ;;
|
|
51
|
-
esac
|
|
52
|
-
done
|
|
53
|
-
|
|
54
|
-
if [ -t 1 ] && [ -z "${NO_COLOR:-}" ]; then
|
|
55
|
-
RED=$'\033[31m'; GREEN=$'\033[32m'; YELLOW=$'\033[33m'; NC=$'\033[0m'
|
|
56
|
-
else
|
|
57
|
-
RED=''; GREEN=''; YELLOW=''; NC=''
|
|
58
|
-
fi
|
|
59
|
-
|
|
60
|
-
ok_count=0; skip_count=0; warn_count=0; fail_count=0
|
|
61
|
-
SELF_NAME="$(basename "$0")"
|
|
62
|
-
|
|
63
|
-
ok() { printf '%s ok %s %s\n' "$GREEN" "$NC" "$1"; ok_count=$((ok_count + 1)); }
|
|
64
|
-
skip() { printf '%sskip %s %s\n' "$YELLOW" "$NC" "$1"; skip_count=$((skip_count + 1)); }
|
|
65
|
-
warn() { printf '%swarn %s %s\n' "$YELLOW" "$NC" "$1"; warn_count=$((warn_count + 1)); }
|
|
66
|
-
fail() { printf '%sfail %s %s\n' "$RED" "$NC" "$1"; fail_count=$((fail_count + 1)); }
|
|
67
|
-
|
|
68
|
-
have() { command -v "$1" >/dev/null 2>&1; }
|
|
69
|
-
|
|
70
|
-
search() {
|
|
71
|
-
[ "$#" -gt 0 ] || return 1
|
|
72
|
-
# VERIFY_FORCE_GREP=1 pins the grep branch so the suite can prove both engines agree, instead
|
|
73
|
-
# of only exercising whichever one happens to be installed.
|
|
74
|
-
if have rg && [ -z "${VERIFY_FORCE_GREP:-}" ]; then
|
|
75
|
-
rg -n --no-heading --glob "!$SELF_NAME" "$@"
|
|
76
|
-
else
|
|
77
|
-
local pattern="${*: -1}"
|
|
78
|
-
grep -rnE \
|
|
79
|
-
--exclude="$SELF_NAME" \
|
|
80
|
-
--exclude-dir=node_modules --exclude-dir=.git --exclude-dir=.next \
|
|
81
|
-
--exclude-dir=dist --exclude-dir=build \
|
|
82
|
-
"$pattern" . 2>/dev/null
|
|
83
|
-
fi
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
# --- the tell registry ------------------------------------------------------
|
|
87
|
-
# Columns, delimited by %% (the pattern column needs `|` for ERE alternation):
|
|
88
|
-
# id %% sev %% extensions %% POSIX-ERE pattern %% what to do instead / the legit exception
|
|
89
|
-
#
|
|
90
|
-
# Patterns are POSIX ERE: no lookahead, no \b, no \s — they must behave identically under rg and
|
|
91
|
-
# under grep -E. The bar they encode is adapted from emilkowalski/skills (MIT).
|
|
92
|
-
#
|
|
93
|
-
# Severity is load-bearing, not decoration. `fail` is for a defect with no legitimate reading;
|
|
94
|
-
# `warn` is for a pattern whose exception is real and cannot be seen from one line (a centered
|
|
95
|
-
# modal, an accordion animating height). A table where everything fails gets switched off (P7).
|
|
96
|
-
motion_tell_table() {
|
|
97
|
-
cat <<'TELLS'
|
|
98
|
-
transition-all%%fail%%tsx,jsx,ts,js,css,scss,html,vue,svelte%%transition:[[:space:]]*all|transition-all%%transition: all animates every property that ever changes, including layout ones, and janks. Name the exact properties instead: transition-property: transform, opacity
|
|
99
|
-
scale-zero-entrance%%fail%%tsx,jsx,ts,js,css,scss,html,vue,svelte%%scale\(0\)|scale3d\(0,|scale:[[:space:]]*0[,;}[:space:]]%%nothing in the real world appears from nothing, so an entrance from zero scale reads as broken. Start from scale(0.9)-scale(0.97) plus opacity: 0
|
|
100
|
-
ease-in-ui%%fail%%tsx,jsx,ts,js,css,scss,html,vue,svelte%%(^|[^a-zA-Z])ease-in([^-]|$)%%ease-in starts slow, delaying the exact moment the user is watching, so the interface feels sluggish. Use ease-out, or the stronger cubic-bezier(0.23, 1, 0.32, 1). Legitimate exception: an exit that must accelerate off-screen
|
|
101
|
-
origin-center-popover%%warn%%tsx,jsx,ts,js,css,scss,html,vue,svelte%%transform-origin:[[:space:]]*center%%a popover, dropdown, menu or tooltip should grow out of the trigger that opened it, not out of its own middle. Use transform-origin: var(--transform-origin). Legitimate exception: a modal, which is not anchored to a trigger and stays centered
|
|
102
|
-
layout-property-animation%%warn%%css,scss%%transition-property:[[:space:]]*(width|height|margin|padding|top|left)|transition:[[:space:]]*(width|height|margin|padding|top|left)[[:space:]]%%animating a layout property triggers layout, paint and composite every frame. Animate transform and opacity instead. Legitimate exception: an accordion height, which has no transform equivalent
|
|
103
|
-
motion-shorthand-under-load%%warn%%tsx,jsx,ts,js%%animate=\{\{[[:space:]]*(x|y|scale):%%the Motion x/y/scale shorthands are not hardware-accelerated: they run on the main thread and drop frames while the page is busy. Use the full transform string: animate={{ transform: "translateX(100px)" }}
|
|
104
|
-
TELLS
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
run_motion_tell_table() {
|
|
108
|
-
local line id sev globs pat msg hits exts rest
|
|
109
|
-
# NOT `IFS='%%'`: IFS is a set of characters, so it would split on a single `%`. Parameter
|
|
110
|
-
# expansion splits on the two-character delimiter exactly, which the pattern column needs to
|
|
111
|
-
# keep its ERE `|`.
|
|
112
|
-
while IFS= read -r line; do
|
|
113
|
-
case "$line" in ''|'#'*) continue ;; esac
|
|
114
|
-
id="${line%%"%%"*}"; rest="${line#*"%%"}"
|
|
115
|
-
sev="${rest%%"%%"*}"; rest="${rest#*"%%"}"
|
|
116
|
-
globs="${rest%%"%%"*}"; rest="${rest#*"%%"}"
|
|
117
|
-
pat="${rest%%"%%"*}"; msg="${rest#*"%%"}"
|
|
118
|
-
exts="${globs//,/|}"
|
|
119
|
-
# Two post-filters, both taken from design/scripts/verify.sh where they were learned from a
|
|
120
|
-
# real run: keep only the extensions the row declares (anchored before the first colon, so it
|
|
121
|
-
# behaves the same under rg and grep and never matches content that merely names a file), and
|
|
122
|
-
# drop matches that sit inside a code comment. `ease-in` in `/* not ease-in */` is not code,
|
|
123
|
-
# and flagging it trains the reader to ignore the tool.
|
|
124
|
-
hits="$(search "$pat" 2>/dev/null \
|
|
125
|
-
| grep -E "^[^:]*\.($exts):" \
|
|
126
|
-
| grep -vE "^[^:]*:[0-9]+:[[:space:]]*(//|/\*|\*[^a-zA-Z]|#|<!--|\{/\*)" || true)"
|
|
127
|
-
if [ -n "$hits" ]; then
|
|
128
|
-
case "$sev" in
|
|
129
|
-
warn) warn "$id: $msg" ;;
|
|
130
|
-
*) fail "$id: $msg" ;;
|
|
131
|
-
esac
|
|
132
|
-
printf '%s\n' "$hits" | head -n 5
|
|
133
|
-
fi
|
|
134
|
-
done <<EOF
|
|
135
|
-
$(motion_tell_table)
|
|
136
|
-
EOF
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
# --- the counter that cannot be a row ---------------------------------------
|
|
140
|
-
# Absence of a guard has no line to match, so it cannot ride the generic mechanism. It carries its
|
|
141
|
-
# own named test instead of pretending to be a row.
|
|
142
|
-
reduced_motion_counter() {
|
|
143
|
-
# Only meaningful where motion actually exists: telling a backend repo to add a reduced-motion
|
|
144
|
-
# guard is the noise that gets a checker switched off.
|
|
145
|
-
if search 'transition:|transition-property|@keyframes|animation:|animate=\{|useSpring|animate-\[' >/dev/null 2>&1; then
|
|
146
|
-
if search 'prefers-reduced-motion|useReducedMotion|motion-safe:|motion-reduce:' >/dev/null 2>&1; then
|
|
147
|
-
ok "reduced-motion-missing: motion is present and a reduced-motion guard was found"
|
|
148
|
-
else
|
|
149
|
-
fail "reduced-motion-missing: this project animates but no prefers-reduced-motion guard was found anywhere. Reduced motion means fewer and gentler animations, not zero: keep opacity and color transitions that aid comprehension, drop movement and position changes"
|
|
150
|
-
fi
|
|
151
|
-
else
|
|
152
|
-
skip "reduced-motion-missing: no motion found in this project, nothing to guard"
|
|
153
|
-
fi
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
# --- run --------------------------------------------------------------------
|
|
157
|
-
run_motion_tell_table
|
|
158
|
-
reduced_motion_counter
|
|
159
|
-
|
|
160
|
-
printf '\nok=%d skip=%d warn=%d fail=%d\n' "$ok_count" "$skip_count" "$warn_count" "$fail_count"
|
|
161
|
-
|
|
162
|
-
if [ "$fail_count" -gt 0 ]; then exit 1; fi
|
|
163
|
-
if [ "$STRICT" -eq 1 ] && [ "$warn_count" -gt 0 ]; then exit 1; fi
|
|
164
|
-
exit 0
|