Created
June 21, 2018 22:27
-
-
Save madfriend/f6b55c63f8c073c830f1c25ce64db9a0 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