Skip to content

Instantly share code, notes, and snippets.

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