MDN self-hosted library · e01.org

Animation: ready property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
animation.ready.then(() => {
  // Do whatever needs to be done when
  // the animation is ready to run
});
js
animation.pause();
animation.ready.then(() => {
  // Displays 'running'
  alert(animation.playState);
});
animation.play();