Skip to content

Instantly share code, notes, and snippets.

@madfriend
Created Jun 21, 2018
Embed
What would you like to do?
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