# Transitions

Animate between states, or loop.

Source: https://www.zazz.sh/api/utilities/transitions/

`--transition: var(--default-transition)` covers the commonly animated properties with the kit's spring easing. A `--<utility>--starting` tier sets the value the element animates in from.

To animate fewer properties, use one of the groups `--default-transition` is built from: `--default-transition-colors`, `--default-transition-transforms`, `--default-transition-effects` (opacity, filters, shadow), and `--default-transition-content` (`display`, `overlay` and the other discrete properties, with `allow-discrete`). A button that only changes color can use `--transition: var(--default-transition-colors)`. Each group has a matching `--default-transition-property-*` list of names for writing your own `transition-property`.

`--transition-duration` and `--transition-delay` change the timing without restating the property list. They also win over a primitive's own transition, so `--transition-duration: 0.6s` slows a dialog down without touching its CSS. Unlike `--transition`, they take breakpoint tiers as well as states, so a stagger can tighten on small screens:

```html
<li style="--transition: var(--default-transition-effects); --transition-delay: 120ms; --transition-delay--md: 240ms">
```

Like every tiered utility, a tier needs the base value: `--transition-delay--md` alone does nothing.

`prefers-reduced-motion: reduce` sets `--default-transition-duration` to `0s`, but a literal `--transition-duration` keeps its value. To respect the setting, write the duration in terms of the token, for example `--transition-duration: calc(var(--default-transition-duration) * 2)`.

## Animation

`--animation` takes any animation value, with breakpoints and states. The kit ships Tailwind's four loops as tokens: `--spin` for a spinner, `--ping` for a dot that scales out and fades (put it on a copy stacked behind the dot), `--pulse` for a skeleton loader's slow fade, and `--bounce` for a scroll hint.

```html
<svg style="--animation: var(--spin)" aria-hidden="true">…</svg>
<span style="--display: grid-pile">
  <i style="--size: 2; --bg: var(--color-primary); --radius: full; --animation: var(--ping)"></i>
  <i style="--size: 2; --bg: var(--color-primary); --radius: full"></i>
</span>
```

`--spin` runs linear. `--pulse` takes 2s on the default easing. `--ping` and `--bounce` use `--default-animation`, which is `1s`, the default easing, and `infinite`, so a keyframe name composes with it: `--animation: spin var(--default-animation)`. The loops that animate `transform` leave `--rotate`, `--scale`, and `--translate` working on top.

The keyframes are named `spin`, `ping`, `pulse`, and `bounce`, and they sit in the lowest layer, so a page's own keyframes of the same name win. `prefers-reduced-motion: reduce` stops every `--animation` value, your own included.

## Reference

| Utility | Writes | Value | Tiers | Notes |
| --- | --- | --- | --- | --- |
| `--transition` | `transition` | any CSS value | states | `--before-transition` / `--after-transition` |
| `--transition-duration` | `transition-duration` | any CSS value | breakpoints, states | `--before-transition-duration` / `--after-transition-duration` |
| `--transition-delay` | `transition-delay` | any CSS value | breakpoints, states | `--before-transition-delay` / `--after-transition-delay` |
| `--animation` | `animation` | any animation value, or a token: var(--spin), var(--ping), var(--pulse), var(--bounce) | breakpoints, states | works tier-only |
