# animation-composition

> The `animation-composition` CSS property specifies how multiple animations affecting the same property are combined.

## How do I combine multiple CSS animations on the same property?

The property that defines the operation used when several animations change the same property simultaneously. Takes 'replace', 'add' or 'accumulate' values, which allows, for example, combining two `transform` animations instead of overriding one.

- Topic: Animations
- Type: property
- Browser support: Chrome 112+, Chrome Android 112+, Edge 112+, Firefox 115+, Firefox Android 115+, Safari 16+, Safari iOS 16+

## Example

Wrong:

```css
.icon {
  transform: rotate(45deg);
  animation: grow 1s;
}
@keyframes grow {
  to { transform: scale(1.5); }
}
```

Right:

```css
.icon {
  transform: rotate(45deg);
  animation: grow 1s;
  animation-composition: add;
}
@keyframes grow {
  to { transform: scale(1.5); }
}
```

With 'add', the keyframe `scale()` is appended to the element's own rotation instead of replacing it.

## Common mistakes

- The element's own `transform` is lost during the animation, because the default 'replace' overrides it.

## Key points

- 'add' or 'accumulate' is set when keyframes must build on the element's own `transform` instead of replacing it.
- `animation-composition` lists one value per animation, in the same order as `animation-name`.

## Interview questions

### What is the difference between add and accumulate?

For `transform`, 'add' appends the functions to the list, while 'accumulate' merges matching ones, so `translateX(10px)` plus `translateX(20px)` becomes `translateX(30px)`.

### What is the default value of animation-composition?

'replace', so keyframe values override the property's base value.

## Related cards

- [animation](https://wonderium.dev/css/animation.md)
- [@keyframes](https://wonderium.dev/css/keyframes.md)
- [transform](https://wonderium.dev/css/transform.md)
- [animation-name](https://wonderium.dev/css/animation-name.md)
- [translate](https://wonderium.dev/css/translate-property.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/animation-composition
- Last updated: 2026-11-25
