CKTIS / CSS
animation-duration: the length of one cycle
Set how long a time-driven animation takes for one iteration, independently of its delay and repeat count.
Version: CSS Modules
Syntax
animation-duration: 1s, 250ms;animation-duration sets the duration of one iteration, not the total time including all repetitions or the initial delay. Use a nonnegative time with s or ms; a negative time or a bare nonzero number is invalid. Comma-separated values correspond to animation-name entries; a shorter duration list repeats to cover the names. For an ordinary time-driven animation, duration multiplied by animation-iteration-count gives the active duration, while animation-delay is separate.
CSS Animations Level 2 defines auto as the initial value. On the document timeline, auto behaves as 0s; legacy resolved-style reporting may show 0s. Zero does not mean that the animation is absent: its active interval is instantaneous, start/end events can still occur, and animation-fill-mode determines any visible before/after effect. On a scroll-driven timeline, auto instead fills the relevant timeline range considering the other timing settings; the current draft treats an explicit time there as auto. That does not make a scrolling animation last a fixed number of wall-clock seconds.
The example creates paused linear opacity animations and samples each at 500ms. A 1s cycle yields 0.5 and a 2s cycle yields 0.25. With both fill and the default forward direction, 0s and auto already expose the endpoint 1; their computed iteration durations are zero. The browser also rejects -1s and the bare value 1. These are actual computed-style and timing reads, not a countdown or a claim about frame rate.
Examples
const style=document.createElement('style');
style.textContent='@keyframes duration-demo{from{opacity:0}to{opacity:1}}';document.head.append(style);
const make=duration=>{const el=document.createElement('div');el.style.cssText='opacity:0.3;animation-name:duration-demo;animation-timing-function:linear;animation-fill-mode:both;animation-play-state:paused';el.style.animationDuration=duration;document.body.append(el);const animation=el.getAnimations()[0];animation.currentTime=500;return {el,animation}};
const rows=['1s','2s','0s','auto'].map(make);
console.log('opacity='+rows.map(({el})=>getComputedStyle(el).opacity).join(','));
console.log('duration='+rows.map(({animation})=>animation.effect.getComputedTiming().duration).join(','));
console.log('negative='+CSS.supports('animation-duration','-1s')+'; unitless='+CSS.supports('animation-duration','1')+'; auto='+CSS.supports('animation-duration','auto'));Result
opacity=0.5,0.25,1,1 duration=1000,2000,0,0 negative=false; unitless=false; auto=true
Executed in Chromium 157.0.8103.51 on the document timeline. The example verifies time-based duration and auto, not scroll-driven timing or event delivery. The scroll explanation follows the current CSS Animations Level 2 draft; test that feature separately on target browsers.