Skip to content

Instantly share code, notes, and snippets.

@madfriend
Created June 21, 2018 22:27
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 madfriend/f6b55c63f8c073c830f1c25ce64db9a0 to your computer and use it in GitHub Desktop.
Save madfriend/f6b55c63f8c073c830f1c25ce64db9a0 to your computer and use it in GitHub Desktop.
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