Skip to content
Back to skills

Motion

ASecurity

How UI motion should feel: whether to animate, easing and duration tables, enter/exit, stagger, drag with momentum, interruptible transitions, mobile-native feel, jank-free performance, reduced motion, motion review. Load before adding, changing or reviewing an animation or gesture.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
ai-agentsgoreactexpressspringtestingapiperformance

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add k6w/baton --skill motion --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Motion?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Motion
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/k6w-motion/badge)](https://www.skillsdirectory.com/skills/k6w-motion)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: motion
description: "How UI motion should feel: whether to animate, easing and duration tables, enter/exit, stagger, drag with momentum, interruptible transitions, mobile-native feel, jank-free performance, reduced motion, motion review. Load before adding, changing or reviewing an animation or gesture."
keywords: [animation, animate, motion, transition, easing, spring, gesture, drag, swipe, sheet, drawer, stagger, jank, reduced motion, hover, mobile feel]
---
# Motion

Motion is there to explain what happened: where something came from, where it went, that the
interface heard the press. Every animation costs the user time, so each one has to earn it. This
skill owns *how things move*. Visual style is `design-taste`; checking that a flow works is
`ui-testing`; screenshots are `visual-qa`.

Long material lives in references (load with `load_skill("motion", "references/<file>")`):
`recipes.md` (copy-ready CSS/JS), `gestures.md` (drag, swipe, sheets), `performance.md`
(jank diagnosis), `mobile-native.md` (phone feel).

## 1. Decide whether it moves

Ask how often the user will see it.

| How often | Decision |
|---|---|
| Many times an hour (shortcuts, command palette, list keyboard nav, tab switches) | No animation. Instant. |
| Many times a day (hover, menus, selects) | Minimal: a fast fade or nothing; close may fade, open is instant |
| Now and then (dialogs, drawers, toasts, route changes) | A standard short animation |
| Rarely (first run, success moments, a marketing hero) | Room for something expressive |

- **Anything triggered from the keyboard is instant.** People who use shortcuts are the ones a delay annoys most.
- Name the purpose in one phrase before writing code: *shows origin*, *confirms the press*,
  *keeps place during a layout change*, *explains a feature*, *softens an abrupt swap*. "Looks
  nice" is only a reason for things seen rarely.
- If removing the animation loses no information, prefer removing it.

## 2. Easing and duration

| Situation | Easing | Duration |
|---|---|---|
| Press feedback (`:active`) | ease-out | 100–160ms |
| Tooltip, small popover | ease-out | 120–180ms |
| Dropdown, select, menu | ease-out | 150–220ms |
| Dialog, drawer, sheet | ease-out (sheets: steep drawer curve) | 200–400ms (edge sheets up to ~500ms) |
| Element moving or resizing on screen | ease-in-out | 200–300ms |
| Colour, background, border on hover | ease | 100–150ms |
| Progress, marquee, hold-to-confirm fill | linear | as long as the thing it measures |
| Toast entering a stack | ease-out | 300–400ms |
| Explanatory / marketing sequence | as designed | can be longer, seen once |

Product UI stays under ~300ms; dialogs and sheets are the exceptions. Shorter feels faster, and
an ease-out curve at 200ms feels quicker than ease-in at 200ms because it moves at once.

```css
:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);        /* strong deceleration: UI enter */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);     /* on-screen moves */
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);      /* edge sheets: steep start, soft landing */
}
```

- **Never ease-in for something the user just triggered.** It starts slowly at the exact moment they are watching.
- The built-in `ease-out` keyword is weak; use a strong custom curve as a token and reuse it.
- **Springs** for anything that can be grabbed, flung or interrupted mid-flight: they keep velocity
  when retargeted. Keep bounce low (0–0.2) and only after a gesture that applied force; a dialog
  opened by a click gets no bounce.
- One component, one timing family: if a drawer opens in 300ms its inner resize and crossfade don't run at 600ms.

## 3. Enter and exit

- **Nothing appears from nothing.** Enter from `opacity: 0` plus a small offset (`translateY(4–8px)`)
  or `scale(0.95–0.98)`, never `scale(0)`.
- **Origin matters.** Popovers, menus and tooltips grow from their trigger (`transform-origin` at the
  anchor). Dialogs are centred, so they scale from the centre.
- **Exits are faster and quieter than entrances** (about 70–80% of the duration, less travel). The user
  has already decided; don't make them watch.
- **Leave the way you came.** A toast that slid up leaves downward; a panel from the right exits right.
- An element that is leaving gives its space back immediately so neighbours close the gap while it fades,
  not after.
- `@starting-style` (or a mounted attribute set after first paint) for CSS enter animations; keep
  `display`/`visibility` swaps at the end of exits so hidden things stop taking clicks.
- Swapping an icon or label in place: crossfade with a slight scale and 2–4px blur; blur hides the moment where both states are visible.

## 4. Several things at once (choreography)

1. **Cast the parts:** one *lead* (the thing the user must notice), some *support*, decoration
   (fades only), and static (doesn't move). Most groups shrink here. Two leads means a hierarchy
   problem motion can't fix.
2. **One entrance per container.** If the panel slides in, its rows are already inside it. Never animate the parent *and* stagger the children.
3. **Together by default; sequence only when order means something** (reading order, cause then effect,
   or two dense states that would look broken overlapping). Let a sequence's steps overlap slightly.
4. **Stagger:** 25–60ms steps, whole group done in ~300ms in product UI. Stagger only the first
   handful of a long list; the rest arrive with the last one. Vary distance by role (lead travels
   most) and let gaps shrink, so it reads as a wave, not a metronome.
5. **Never stagger frequently opened UI** (menus, dropdowns, tab content, command results).
6. **Nothing waits for decoration.** Everything visible is clickable now.
7. **Direction follows meaning:** forward = new content from the inline-end side, back = the reverse
   (mirror for RTL); things the user triggered spread outward from the point of interaction.
8. Exits of a group happen all at once, not reverse-staggered.

Write the timeline (element, role, start, duration, motion) before coding anything with more than two moving parts.

## 5. Interruptible by default

- Interactions use **CSS transitions** (they retarget from the current value). `@keyframes` restart
  from zero; keep them for one-shot sequences and loops.
- Test every animated state by triggering it again mid-flight: toggle twice fast, close while opening,
  press Escape during the enter, click Next twice. Nothing may jump, stack or end in the wrong state.
- Imperative sequences cancel the in-flight run before starting a new one (`animation.cancel()`,
  an abort flag, or the library's stop) and never chain on a timer that ignores interruption.
- State is the source of truth, not the animation: if the animation is skipped (reduced motion, a
  background tab, a test), the UI still ends in the right state.

## 6. Gestures, in one paragraph

While the finger is down the element follows it 1:1 (no easing, no spring, no React state per
move); on release, physics finishes the move with a spring seeded by the release velocity.
Dismiss on distance **or** a fast flick. Past a boundary, resist (rubber-band) instead of stopping
dead. Capture the pointer, ignore extra touches, and set `touch-action` for the axis you own.
Everything linked to the drag (overlay opacity, page scale) is derived from the same value. Full
rules and code: `references/gestures.md`.

## 7. Performance

- Animate **`transform` and `opacity`**. Anything else needs a reason: `width/height/top/left/margin/padding`
  re-lay-out the page every frame; `box-shadow`, `background`, `border-radius`, large `filter: blur()`
  repaint every frame.
- Never `transition: all`; list the properties.
- Grow with `scale`, move with `translate`, reveal with `clip-path` or `opacity`, shadows by fading a
  pseudo-element that already has the shadow.
- Don't drive per-frame motion through React state or through a CSS variable on a parent (every
  descendant recalculates); write `transform` on the element itself.
- Animations that play while the page is busy (route change, data load, hydration) belong in CSS or
  the Web Animations API, not a `requestAnimationFrame` loop.
- `will-change` is a fix for a measured problem (a 1px shift at start/end, a costly filtered layer),
  added to the moving element only, and removed when idle if it's large.
- Budget: 16.7ms per frame at 60Hz, 8.3ms at 120Hz. "Smooth on my laptop" proves nothing; measure
  with a performance recording at 4–6× CPU throttle. Diagnosis steps: `references/performance.md`.

## 8. Reduced motion

`prefers-reduced-motion: reduce` means less movement, not a broken UI:

- Drop translation, scaling, parallax, auto-playing loops, stagger delays and bounce. Keep short
  opacity and colour changes that carry meaning (a state change, focus, a toast appearing).
- Content the user drags still follows the finger; the fling and overshoot after release go.
- Sequences collapse: everything appears together.
- Auto-playing video and carousels pause by default and get a visible pause control either way.
- Write motion inside `@media (prefers-reduced-motion: no-preference)` or switch tokens:

```css
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
```

(The blanket rule is a safety net; still design the reduced version of anything important.)

## 9. Touch and hover

- All hover effects inside `@media (hover: hover) and (pointer: fine)`; touch gets feedback from
  `:active` on press instead.
- Press feedback on pointer-down, not on click. `touch-action: manipulation` on tappable things.
- The rest of the phone-feel fixes (tap highlight, `dvh`, 16px inputs, safe areas, overscroll):
  `references/mobile-native.md`.

## 10. Motion review checklist

Report each problem as `file:line · what · why · fix`. Severity: **blocking** (breaks use: stuck
state, unclickable during animation, motion sickness trigger with no reduced version, jank on a
core path), **major** (wrong easing/duration/origin, animates something frequent), **minor** (polish).

- [ ] Every animation has a stated purpose; frequent and keyboard-driven actions are instant.
- [ ] No `transition: all`; only `transform`/`opacity` animate unless justified.
- [ ] No ease-in on enters; durations within the table; exits faster than enters.
- [ ] No `scale(0)` entrances; popovers originate at their trigger; dialogs from centre.
- [ ] One entrance per container; no stagger on frequent UI; stagger total ≲300ms.
- [ ] Re-triggering mid-flight never jumps, stacks or strands a state.
- [ ] Interaction is never blocked while something animates.
- [ ] Drags track 1:1, release with velocity, dismiss on flick, resist at edges.
- [ ] Hover gated to fine pointers; touch has `:active` feedback.
- [ ] Reduced motion handled and checked (DevTools "Emulate CSS prefers-reduced-motion").
- [ ] No per-frame React state, no animated parent CSS variable, `will-change` only where measured.
- [ ] Watched at 0.25× speed (DevTools Animations panel) and stepped frame by frame for anything
      with several moving parts; claims about feel that need a real phone are marked "needs device".

To verify motion in a running app (a scripted flow that toggles states and checks no errors),
see `ui-testing`.

Files in this skill

  • SKILL.md11.2 KB
  • references/gestures.md5.9 KB
  • references/mobile-native.md4.2 KB
  • references/performance.md5.5 KB
  • references/recipes.md6.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.