CKTIS / JavaScript
Animation.pause() — pausing an animation
Animation.pause() suspends animation playback without canceling it. The operation can be pending; animation.ready lets you wait for its completion.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
animation.pause();animation.pause() takes no arguments and returns undefined, not a promise. It suspends the animation's advancing time; play() resumes playback, whereas cancel() cancels it.
Pausing can require synchronization. Use await animation.ready, rather than await animation.pause(). Merely observing playState === 'paused' does not prove completion: pending can still be true.
This is a Web Animations browser API, not an ECMAScript feature. Do not infer support from a Node.js version; check your target browsers.
Examples
(async () => {
const box = document.createElement('div');
box.textContent = 'Pause demo';
document.body.append(box);
const animation = box.animate(
[{ opacity: 0 }, { opacity: 1 }],
{ duration: 1000, fill: 'both' }
);
animation.pause();
await animation.ready;
animation.currentTime = 500;
console.log(animation.playState);
console.log(animation.currentTime);
console.log(animation.pending);
animation.cancel();
box.remove();
})();Result
paused 500 false
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.