Skip to content

Instantly share code, notes, and snippets.

@bendc
Created August 28, 2017 13:19
Show Gist options
  • Save bendc/91ed22ba806c29e569944b83dfa03ad5 to your computer and use it in GitHub Desktop.
Save bendc/91ed22ba806c29e569944b83dfa03ad5 to your computer and use it in GitHub Desktop.
rAF tutorial: better setTimeout
const delay = (callback, duration) => {
const tick = () =>
getProgress(time) < 1 ? requestAnimationFrame(tick) : callback();
const time = {
duration,
id: requestAnimationFrame(tick)
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment