Skip to content

Instantly share code, notes, and snippets.

@cristinecula
Created August 2, 2019 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cristinecula/5887c17250bd91b83227f8c1048f2417 to your computer and use it in GitHub Desktop.
Save cristinecula/5887c17250bd91b83227f8c1048f2417 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/wubifok
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://rawgit.com/web-animations/web-animations-js/master/web-animations.min.js"></script>
</head>
<body>
Using web animations polyfill
<script>
const animation = document.body.animate([{opacity: 0}, {opacity: 1}], 500)
animation.onfinish = event => {
console.log('onfinish', animation.playState)
}
animation.oncancel = event => {
console.log('oncancel', animation.playState)
}
</script>
</body>
</html>
@cristinecula
Copy link
Author

Console output:
"onfinish" "finished"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment