CKTIS / CSS
animation-play-state: pause and continue the same animation
Hold animation progress and resume it without discarding the current position.
Version: CSS Modules
Syntax
animation-play-state: paused;animation-play-state accepts running or paused, with running as the initial value. Pausing holds the animation clock and keeps its current effect visible. Returning to running continues from that position instead of starting over. The pause also freezes an unfinished animation-delay. With several animation-name entries, comma-separated play states control individual animations; a shorter list repeats.
Pause is not cancellation, removal of the animation name, or a reset of the underlying style. It does not pause unrelated transitions, videos or JavaScript work. A finished animation does not automatically become a fresh cycle just because running is declared again. Explicit play/pause control through the Web Animations API can also override the corresponding CSS control according to its separate rules; keep ownership clear rather than mixing two controllers accidentally.
The example starts a CSS animation paused, sets its position to 250ms and reads opacity 0.25. Two animation frames later the time is unchanged. Switching the CSS property to running advances the same animation object beyond that position; switching it back to paused holds the new time across two more frames. A separate animation with a 1s delay stays at 400ms in that delay while paused, leaving underlying opacity 0.7. The printed advancement checks are booleans, not invented fixed frame intervals.
Examples
const style=document.createElement('style');style.textContent='@keyframes play-demo{from{opacity:0}to{opacity:1}}';document.head.append(style);
const frame=()=>new Promise(resolve=>requestAnimationFrame(resolve));
const el=document.createElement('div');el.style.cssText='opacity:0.7;animation-name:play-demo;animation-duration:1s;animation-timing-function:linear;animation-fill-mode:both;animation-play-state:paused';document.body.append(el);
const animation=el.getAnimations()[0];await animation.ready;animation.currentTime=250;const held=animation.currentTime,opacity=getComputedStyle(el).opacity;
await frame();await frame();const stable=animation.currentTime===held;
el.style.animationPlayState='running';getComputedStyle(el).animationPlayState;await animation.ready;await frame();await frame();
const advanced=animation.currentTime>held,same=el.getAnimations()[0]===animation;
el.style.animationPlayState='paused';getComputedStyle(el).animationPlayState;await animation.ready;const stopped=animation.currentTime;await frame();await frame();
const delayed=document.createElement('div');delayed.style.cssText='opacity:0.7;animation:play-demo 1s linear 1s paused';document.body.append(delayed);
const waiting=delayed.getAnimations()[0];await waiting.ready;waiting.currentTime=400;await frame();await frame();
console.log('held='+held+'; opacity='+opacity+'; stable='+stable);
console.log('resumed='+advanced+'; same-animation='+same+'; paused-again='+(animation.currentTime===stopped)+'; state='+animation.playState);
console.log('delay-held='+(waiting.currentTime===400)+'; delay-opacity='+getComputedStyle(delayed).opacity);Result
held=250; opacity=0.25; stable=true resumed=true; same-animation=true; paused-again=true; state=paused delay-held=true; delay-opacity=0.7
Executed in Chromium 157.0.8103.51 with real animation-frame callbacks. The code changes CSS play state; currentTime is used only to establish sample positions. It verifies pause/resume and a paused delay, not background-tab scheduling, finished-animation restart or the API override cases.