Skip to content

Instantly share code, notes, and snippets.

@bendc
Created August 28, 2017 13:19
Embed
What would you like to do?
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