interfaceElement.addEventListener("mousedown", () => {
try {
player.finish();
} catch (e) {
if (e instanceof InvalidState) {
console.log("finish() called on paused or finished animation.");
} else {
logMyErrors(e); // Pass exception object to error handler
}
}
});Animation: finish() method / notebook
Animation: finish() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
elem.getAnimations().forEach((animation) => animation.finish());