6.6 · Motion
Stack animations: animation-composition
Add an animation on top of an existing value instead of replacing it.
When an animation sets transform, it normally replaces
the element’s own transform. A shifted box that spins
snaps back to its original spot.
animation-composition: add combines them: the box stays
shifted and spins on top. accumulate merges the values
instead, which matters for functions like scale().
/* Wrap it to keep both transforms */
<div class="shift">
<div class="spin">★</div>
</div>
.box {
transform: translateX(6rem);
animation: spin 3s linear infinite;
animation-composition: add;
}