# Motion

Short, springy and physical, like soft toys. Durations stay between 80 and 360 ms. Everything stops under `prefers-reduced-motion`.

## Utilities

Add a class to any element. Click a tile to replay it.

- `cz-motion-pop`: Rewards and toasts appearing

- `cz-motion-bounce-in`: Cards dealt onto the table

- `cz-motion-rise`: Content fading up into place

- `cz-motion-jelly`: Something just got filled or ticked

- `cz-motion-wiggle`: Nudge: “tap me”

- `cz-motion-shake`: Not allowed / wrong input

- `cz-motion-swing`: Hanging tags and signs

- `cz-motion-float`: Idle bubbles over the world (loops)

## Built into components

| Component | Motion |
|---|---|
| Button | Hover lifts 2 px and grows the wall; press sinks it with a 2% squash (80 ms), release springs back with overshoot. |
| Checkbox | Box does a jelly wobble; the tick is stamped in, rotating from −12°. |
| Switch | Thumb rolls with a bounce and squashes as it lands. |
| Slider | Thumb swells on hover and flattens while dragged. |
| Tabs | One raised tile slides to the active tab with overshoot; the panel rises in. |
| Progress | Fill springs to its value; stripes roll; at 100% it glints. |
| Tooltip | Swings in like a hanging tag. |
| Dialog | Overlay fades; the board bounces in and drops away on close. |
| Input | Shakes once when it becomes invalid. |

## Tokens

| Token | Value | Use |
|---|---|---|
| `--cz-motion-instant` | `80ms` |  |
| `--cz-motion-fast` | `140ms` | hover, press |
| `--cz-motion-base` | `220ms` | toggles, tabs, tooltips |
| `--cz-motion-slow` | `360ms` | dialogs, toasts, progress |
| `--cz-motion-ease-out` | `cubic-bezier(0.2, 0.8, 0.2, 1)` |  |
| `--cz-motion-ease-bounce` | `cubic-bezier(0.34, 1.56, 0.64, 1)` | toy-like overshoot; USS: ease-out-back |
| `--cz-motion-ease-spring` | `cubic-bezier(0.5, 1.8, 0.4, 0.8)` | stronger overshoot for pops |

Keyframes animate the individual `translate`, `scale` and `rotate` properties, so they never fight the `transform` that Radix and sonner use for positioning.

```css
.my-coin-burst {
  animation: cz-pop var(--cz-motion-slow) var(--cz-motion-ease-out) both;
}
```

Docs: https://cozy-ui.solo.engineer/docs/motion/
