Skip to content

Instantly share code, notes, and snippets.

@t1ger-0527
Last active July 26, 2018 08:44
Show Gist options
  • Select an option

  • Save t1ger-0527/2187a09f7ecf068d4ff44a9a54f9bc85 to your computer and use it in GitHub Desktop.

Select an option

Save t1ger-0527/2187a09f7ecf068d4ff44a9a54f9bc85 to your computer and use it in GitHub Desktop.
Call something after multiple animation frame. So-called requestMultipleAnimationFrame
function requestMultipleAnimationFrame(cb, times) {
if (times === 1) {
return requestAnimationFrame(cb);
} else {
return requestAnimationFrame(() => {
requestMultipleAnimationFrame(cb, times - 1);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment