Loading...
.icon {
transform: rotate(45deg);
animation: grow 1s;
}
@keyframes grow {
to { transform: scale(1.5); }
}.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.
transform is lost during the animation, because the default 'replace' overrides it.transform instead of replacing it.animation-composition lists one value per animation, in the same order as animation-name.For transform, 'add' appends the functions to the list, while 'accumulate' merges matching ones, so translateX(10px) plus translateX(20px) becomes translateX(30px).
'replace', so keyframe values override the property's base value.