Created
November 6, 2017 02:48
-
-
Save paulfarino/7faed91be017a8e194c625e9c106ed13 to your computer and use it in GitHub Desktop.
Web Animation API Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#thing { | |
height: 200px; | |
width: 200px; | |
background: grey; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="thing">Hello</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const el = document.getElementById('thing'); | |
const player = el.animate([ | |
{ | |
width: '300px', | |
opacity: 0.2 | |
}, | |
{ | |
width: '200px', | |
opacity: 1, | |
} | |
], { | |
duration: 1000, | |
iterations: 2, | |
direction: 'alternate', | |
easing: "cubic-bezier(0.4, 0.0, 1, 1)" | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment