aae4d42229
Adds the agent-facing workspace and a 20-task plan for migrating the site to Astro. Nothing here implements the refactor; these are briefs, rules and templates that the task agents read. - .agents/ holds context, rules, checklists, skills, specialist agents, component/page/config templates and gate scripts. It is vendor-neutral so MiniMax, Gemini and Codex can all read it; CLAUDE.md just points at AGENTS.md. - .husky/ plus .lintstagedrc.json wire the three gate tiers. gate.sh locks on the shared git-common-dir so parallel worktrees serialise, and guards the assertion count in scripts/verify.mjs against a coverage drop. - plans/astro-refactor/ carries the phase graph, per-task briefs and the model-routing recommendation. These files must be tracked before fanning out: a worktree only checks out tracked files, so an untracked plan is invisible to every agent working in one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
69 lines
2.4 KiB
Markdown
69 lines
2.4 KiB
Markdown
---
|
||
name: motion
|
||
description: Add or review animation on the ai-for-dummies site — transitions, state changes, view transitions. Use when any element moves, fades, or transforms, or when auditing existing motion for performance and reduced-motion support.
|
||
---
|
||
|
||
# Motion
|
||
|
||
This is an editorial-print design. Motion is punctuation. Read
|
||
[`../../rules/animation.md`](../../rules/animation.md) — it is binding; this is
|
||
the procedure.
|
||
|
||
## Decide it should move
|
||
|
||
Answer out loud: **what does this motion tell the user that the static state
|
||
does not?** Valid answers: something changed, attention needs directing to what
|
||
changed, a layout shift needs smoothing. "It feels more polished" is not an
|
||
answer — on this design it reads as generic.
|
||
|
||
If there is no answer, ship it static. That is a legitimate, common outcome.
|
||
|
||
## Build it
|
||
|
||
```css
|
||
.panel {
|
||
transition: opacity 180ms cubic-bezier(.2,0,0,1),
|
||
transform 180ms cubic-bezier(.2,0,0,1);
|
||
}
|
||
.panel[data-state='entering'] { opacity: 0; transform: translateY(6px); }
|
||
```
|
||
|
||
- **`transform` and `opacity` only.** Animating `width`/`height`/`top`/`left`
|
||
forces layout every frame and shows up as a failed INP (budget: 200ms).
|
||
- 150–250ms for UI feedback; up to 400ms for a page transition.
|
||
- One thing moves at a time. No staggered card cascades.
|
||
- `will-change` only immediately before animating, removed after.
|
||
- No animation library. This site's thesis is having no runtime dependencies.
|
||
|
||
## Reduced motion is not optional
|
||
|
||
```css
|
||
@media (prefers-reduced-motion: reduce) {
|
||
* { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
|
||
transition-duration: .01ms !important; scroll-behavior: auto !important; }
|
||
}
|
||
```
|
||
|
||
Then **test it**: DevTools → Rendering → Emulate `prefers-reduced-motion:
|
||
reduce`. The end state must still be correct and the UI still usable. Reduced,
|
||
not broken.
|
||
|
||
## Page transitions
|
||
|
||
Astro's `<ClientRouter />` is the only sanctioned motion dependency. Before
|
||
enabling it, verify:
|
||
|
||
- JS disabled → full navigation still works
|
||
- browser back/forward still works
|
||
- the review desk's query-param deep links survive
|
||
- `prefers-reduced-motion` is honoured
|
||
|
||
## Audit an existing animation
|
||
|
||
```bash
|
||
grep -rn "transition\|animation\|@keyframes\|transform" src/ --include="*.astro" --include="*.css"
|
||
```
|
||
|
||
For each hit ask: does it animate a layout property? does it respect reduced
|
||
motion? is there a stated purpose? Three questions, three possible fixes.
|