CKTIS / CSS
animation-composition: replace, add or accumulate an effect
Choose how an animated value combines with the value already underneath it.
Version: CSS Modules
Syntax
animation-composition: replace | add | accumulate;animation-composition selects how an animation effect combines with its underlying value. That value can come from ordinary styles or earlier effects in the stack, so even one animation can demonstrate the difference. The initial replace uses the effect value; add and accumulate use the addition and accumulation rules of the animated property. These operations are not universally ordinary numerical addition.
For transform lists, addition appends the effect list after the underlying list. Order matters: an underlying scale can scale an added translation. Accumulation instead combines corresponding operations, using suitable matching or matrix rules; scale factors combine relative to their neutral value of one. This property does not request accumulation between successive iterations. A comma-separated list matches animation names, and a composition declared inside a keyframe can override the effect-level choice for its properties.
The example has an underlying horizontal translation of 10px followed by scale 2, and a constant animated translation of 20px followed by scale 3. At 500ms, replacement gives scale/translation 3/20; addition gives 6/50; accumulation gives 4/30. The last scale is 2+3-1, whereas the additive translation is 10+2×20. These measured matrix components explain why blindly adding all numbers would be wrong.
Examples
const style=document.createElement('style');style.textContent='@keyframes layer{from,to{transform:translateX(20px) scale(3)}}';document.head.append(style);
const values=[];
for(const composition of ['replace','add','accumulate']){const box=document.createElement('div');box.style.cssText='transform:translateX(10px) scale(2);animation:layer 1s linear both paused';box.style.animationComposition=composition;document.body.append(box);box.getAnimations()[0].currentTime=500;const matrix=new DOMMatrix(getComputedStyle(box).transform);values.push(composition+'='+matrix.a+','+matrix.e)}
console.log(values.join('; '));Result
replace=3,20; add=6,50; accumulate=4,30
Each mode uses an independently created element with identical keyframes and an explicit sample time. The result covers these compatible transform lists, not every property or all possible matrix decompositions.