# Animation Name

Run a keyframes animation you define in your config.

**Widely available.** This feature is well established and works across many devices and browser versions.

Chrome 43 · Edge 12 · Firefox 16 · Safari 9

| Class | Properties | Value |
|-------|------------|-------|
| `an:none` | animation-name | `none` |

> **Note**
>
> `an:none` is the only built-in name. Every other name comes from
> `theme.keyframes` in your config.

## Variants

Prefix any class with a variant to apply it only under that condition. Variants stack, as in `@md:h:an:none`.

### Breakpoints

Apply a class from a viewport width up. Each breakpoint covers its width & every width above it.

| Class | Applies |
|-------|---------|
| `@xs:an:none` | From 32rem up. |
| `@sm:an:none` | From 40rem up. |
| `@md:an:none` | From 48rem up. |
| `@lg:an:none` | From 64rem up. |
| `@xl:an:none` | From 80rem up. |
| `@xxl:an:none` | From 96rem up. |

### Containers

Apply a class from a container's width up, not the viewport's. Mark the parent with `ct:is` first.

| Class | Applies |
|-------|---------|
| `@c:xs:an:none` | Container from 32rem up. |
| `@c:sm:an:none` | Container from 40rem up. |
| `@c:md:an:none` | Container from 48rem up. |
| `@c:lg:an:none` | Container from 64rem up. |
| `@c:xl:an:none` | Container from 80rem up. |
| `@c:xxl:an:none` | Container from 96rem up. |

### Media

Apply a class when the device or the page matches a condition, or on the first frame an element renders.

| Class | Applies |
|-------|---------|
| `@pc:an:none` | On a touch screen. |
| `@prm:an:none` | With reduced motion on. |
| `@st:an:none` | On the first frame. |

### States

Apply a class only while the element is in a state, such as hovered, focused or checked.

| Class | Applies |
|-------|---------|
| `h:an:none` | On :hover. |
| `f:an:none` | On :focus. |
| `fv:an:none` | On :focus-visible. |
| `a:an:none` | On :active. |
| `d:an:none` | On :disabled. |
| `fc:an:none` | On :first-child. |
| `c:an:none` | On :checked. |
| `e:an:none` | On :empty. |
| `fw:an:none` | On :focus-within. |
| `i:an:none` | On :invalid. |
| `in:an:none` | On :indeterminate. |
| `lc:an:none` | On :last-child. |
| `nc:an:none` | On :nth-child. |
| `r:an:none` | On :required. |
| `ro:an:none` | On :read-only. |
| `v:an:none` | On :valid. |

### Pseudo Elements

Style a part of the element rather than the element itself, such as its placeholder or the selected text.

| Class | Applies |
|-------|---------|
| `a::an:none` | On ::after. |
| `b::an:none` | On ::before. |
| `p::an:none` | On ::placeholder. |
| `s::an:none` | On ::selection. |

## Define Keyframes

Name an animation once in `theme.keyframes` & write its body as plain CSS. Each name becomes an `an:` class.

```mjs title="yumma.config.mjs" mark={5-8}
import { defineConfig } from "yummacss";

export default defineConfig({
  theme: {
    keyframes: {
      spin: "to { rotate: 360deg; }",
      "fade-in": "from { opacity: 0; }",
    },
  },
});
```

## Using Keyframes

Combine a name with [Animation Duration](/docs/animation-duration), [Animation Timing Function](/docs/animation-timing-function) & [Animation Iteration Count](/docs/animation-iteration-count).

```tsx title="page.tsx" "an:spin"
<span className="d:b w:4 h:4 bw:2 br:9999 an:spin adu:700 atf:l aic:inf"></span>
```

```css title="output.css"
.an\:spin {
  animation-name: spin;
}

@keyframes spin {
  to { rotate: 360deg; }
}
```

Only the keyframes a class uses are written to the output, once, however many variants use them.

## Reduced Motion

Stop an animation for people who have asked for less motion with the [`@prm:`](/docs/media-queries#reduced-motion) variant.

```tsx "@prm:an:none"
<span className="an:spin adu:700 aic:inf @prm:an:none"></span>
```