---
name: motion-review
description: Review UI animations in the current diff for purpose, timing, easing, smoothness, interruption and reduced-motion support, and fix them. Use when the user asks to review, polish or fix motion, transitions or animations, or says something "stutters", "jumps", "is not smooth" or "seká".
---

# Motion review

Review every animation the diff adds or changes, in this order. For each finding give the
file and line, what is wrong, and the fix as code. Fix it, then check it in a real browser:
a screenshot of a frozen frame proves nothing about motion.

## 1. Purpose

Every animation must explain a change of state, guide attention, or give feedback. If it
only decorates, remove it. A looping shimmer on a waiting label is feedback ("slide me");
a fade-in on every section as you scroll is decoration.

## 2. Timing and curves

| What moves | Duration | Curve |
| --- | --- | --- |
| Hover and press feedback | 100–160 ms | `linear` for colour, ease-out for transform |
| A small swap (icon, label) | 160–260 ms | `cubic-bezier(0.2, 0.8, 0.2, 1)` |
| A surface entering | 220–320 ms | same ease-out, or a spring |
| Layout and size changes | 280–420 ms | same ease-out |
| Exit | 70–80% of the entrance | ease-in or a quick fade |

Pick one ease-out for the whole product and name it once (`const EASE = …`). Loops cycle in
2–4 s; anything that keeps moving past 5 s needs a pause control or must stop on its own.

## 3. Smoothness: only cheap properties

Animate `transform`, `opacity` and `clip-path`. Treat everything else as a finding.

Before: a copy button blurred its icon while swapping, and it stuttered.
```tsx
initial={{ opacity: 0, scale: 0.4, filter: "blur(4px)" }}
```
After: scale and opacity only.
```tsx
style={{ opacity: on ? 1 : 0, transform: on ? "scale(1)" : "scale(0.6)",
         transition: "opacity 160ms linear, transform 260ms cubic-bezier(0.2,0.8,0.2,1)" }}
```

Before: a progress fill animated `width`, which reflows on every frame.
After: the fill keeps its size and is revealed with `clip-path: inset(0 Xpx 0 0 round 999px)`.

## 4. Nothing jumps

- **Text that changes length:** measure the new label and transition the box width, so the
  button glides from "Copy command" to "Copied" instead of snapping.
- **Swaps:** stack old and new in one grid cell (`col-start-1 row-start-1`) and cross-fade.
- **Containers that grow:** reserve the space (a fixed slot as tall as the open state), so an
  expanding stack never covers the button under it.

## 5. Drags follow the finger

React state on every `pointermove` re-renders the component and lags. Move the element on the
DOM inside `requestAnimationFrame`; tell React only when a threshold is crossed and when the
drag ends. Use pointer capture, and wrap `setPointerCapture` in try/catch.
```ts
d.at = clamp(d.start + e.clientX - d.pointer);
cancelAnimationFrame(d.frame);
d.frame = requestAnimationFrame(() => paint(d.at));
if ((d.at > max * 0.85) !== armed) setArmed(!armed); // the only state update while dragging
```
On release, glide back with a transition, or confirm. A quick flick past halfway counts too.

## 6. Interruption

Clicking again mid-animation must not jump or queue. CSS transitions and springs start from the
current value; keyframe animations restart from zero. Timers that drive a sequence are cleared
before a new run starts and on unmount.

## 7. Sequences tell the whole story

A demo's "Animate" plays the full run on its own (upload, process, ready, one step every
~1 s), not one step per click. End states end: when the last step of a progress rail is
reached, do not draw one more check; fold the rail into the final badge.

## 8. Entrances start visible

Never start an entrance at `opacity: 0`. If the tab is in the background or the animation is
paused, the content stays invisible. Start from a visible state that is slightly offset.
```css
@keyframes enter { from { transform: translateY(14px); filter: blur(2px); } }
```

## 9. Reduced motion

With `prefers-reduced-motion: reduce`, movement, blur, pulses and loops stop or drop to a
fade. The component still works and ends in the right final state: a demo that runs a
sequence rests on its finished step, a timer still counts, a confirmation still confirms.
Use `motion-safe:` on decorative loops and check `matchMedia` before imperative animations.

## 10. Server and client draw the same frame

SVG coordinates computed with `Math.cos` can differ in the last digit between Node and the
browser and break hydration. Round them (`Math.round(n * 1000) / 1000`).

## Report

A list ordered by how much each finding hurts the feel: file and line, the problem in one
sentence, the fix as code. Then what you checked in the browser and at which widths.
