Motion Foundations
The base layer of the motion system. Defines every value, constraint, and
rule that downstream skills (motion-patterns, motion-advanced) inherit.
Load this skill before any animation work begins.
When to Activate
- Starting any animated component from scratch
- Setting up tokens, spring presets, or easing values
- Implementing
prefers-reduced-motion support
- Debugging hydration mismatches from animation initial states
- Evaluating whether an animation should exist at all
Outputs
This skill produces:
- A shared
motionTokens object (duration, easing, distance, scale)
- A shared
springs preset map (5 named configs)
- A
shouldAnimate() gate used by all components
- Accessibility-compliant animation defaults via
useReducedMotion
- SSR-safe initial states with zero hydration warnings
Principles
Motion must do at least one of the following or it must be removed:
- Guide attention
- Communicate state
- Preserve spatial continuity
Responsiveness always outranks smoothness. A 60 fps animation that causes
input delay is worse than no animation.
Rules
These are non-negotiable. They apply to every component in the system.
- Use
motion/react only. Never import from framer-motion. Never mix the two in the same tree.
initial must match server output. If the server renders opacity: 1, the initial prop must also be opacity: 1. No exceptions.
- Reduced motion overrides everything. When
useReducedMotion() returns true or prefersReduced is true, all transforms are disabled. Opacity-only fades at ≤ 0.2s are the only permitted fallback.
- Never animate layout properties.
width, height, top, left, margin, padding are banned from animate. Use transform and opacity only.
- All token values come from
motionTokens. Hardcoded durations and easings in component files are forbidden.
- All spring configs come from the
springs map. Inline stiffness/damping values are forbidden.
"use client" is required on every file that imports from motion/react.
- Never read
window or navigator at module level. Always guard with typeof window !== "undefined".
Decision Guidance
Choosing a duration
| Token |
Use when |
instant |
Tooltip show/hide, focus ring, badge update |
fast |
Button feedback, icon swap, chip toggle |
Exemplo
Setup: motionTokens (duration/easing) + springs (5 presets) + shouldAnimate() gate
Componente: initial == server (sem hydration warn), "use client", sem window no módulo
Reduced motion: tudo desliga, só fade ≤0.2s; layout props (width/top) nunca animam
1---2name: motion-foundations3description: "Use when motion tokens, spring presets, performance rules, device adaptation, accessibility enforcement, and SSR safety for React / Next.js using motion/react. Foundation layer — all other motion skills depend on this. Triggers on \"motion-foundations\", \"motion foundations\", \"foundations\"."4version: 1.05tags: [motion, animation, performance, accessibility]6category: frontend7author: jeff8metadata:9 source: https://skillmd.com/skills/majinmagros/motion-foundations10---1112# Motion Foundations1314The base layer of the motion system. Defines every value, constraint, and15rule that downstream skills (`motion-patterns`, `motion-advanced`) inherit.16Load this skill before any animation work begins.1718## When to Activate1920- Starting any animated component from scratch21- Setting up tokens, spring presets, or easing values22- Implementing `prefers-reduced-motion` support23- Debugging hydration mismatches from animation initial states24- Evaluating whether an animation should exist at all2526## Outputs2728This skill produces:2930- A shared `motionTokens` object (duration, easing, distance, scale)31- A shared `springs` preset map (5 named configs)32- A `shouldAnimate()` gate used by all components33- Accessibility-compliant animation defaults via `useReducedMotion`34- SSR-safe initial states with zero hydration warnings3536## Principles3738Motion must do at least one of the following or it must be removed:3940- Guide attention41- Communicate state42- Preserve spatial continuity4344Responsiveness always outranks smoothness. A 60 fps animation that causes45input delay is worse than no animation.4647## Rules4849These are non-negotiable. They apply to every component in the system.50511. **Use `motion/react` only.** Never import from `framer-motion`. Never mix the two in the same tree.522. **`initial` must match server output.** If the server renders `opacity: 1`, the `initial` prop must also be `opacity: 1`. No exceptions.533. **Reduced motion overrides everything.** When `useReducedMotion()` returns `true` or `prefersReduced` is `true`, all transforms are disabled. Opacity-only fades at ≤ 0.2s are the only permitted fallback.544. **Never animate layout properties.** `width`, `height`, `top`, `left`, `margin`, `padding` are banned from `animate`. Use `transform` and `opacity` only.555. **All token values come from `motionTokens`.** Hardcoded durations and easings in component files are forbidden.566. **All spring configs come from the `springs` map.** Inline `stiffness`/`damping` values are forbidden.577. **`"use client"` is required** on every file that imports from `motion/react`.588. **Never read `window` or `navigator` at module level.** Always guard with `typeof window !== "undefined"`.5960## Decision Guidance6162### Choosing a duration6364| Token | Use when |65| --------- | -------------------------------------------- |66| `instant` | Tooltip show/hide, focus ring, badge update |67| `fast` | Button feedback, icon swap, chip toggle |6869## Exemplo7071```text72Setup: motionTokens (duration/easing) + springs (5 presets) + shouldAnimate() gate73Componente: initial == server (sem hydration warn), "use client", sem window no módulo74Reduced motion: tudo desliga, só fade ≤0.2s; layout props (width/top) nunca animam75```