Created
June 21, 2018 22:28
-
-
Save madfriend/a4aef064f58689d345e833da6d880f7f to your computer and use it in GitHub Desktop.
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
let div = document.createElement('div'); | |
div.style.height = '100px'; | |
div.style.width = '100px'; | |
div.style.background = 'red'; | |
div.style.display = 'inline-block'; | |
document.body.appendChild(div); | |
let animator = animate(100, 500, 30); | |
let animationStep = function () { | |
const next = animator.next(); | |
if (next.done) return; | |
div.style.width = next.value + 'px'; | |
requestAnimationFrame(animationStep); | |
} | |
animationStep(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment