Skip to content

Instantly share code, notes, and snippets.

@bendc
Created August 24, 2017 15:31
Show Gist options
  • Save bendc/69489daf094174d85a7240515d9f8480 to your computer and use it in GitHub Desktop.
Save bendc/69489daf094174d85a7240515d9f8480 to your computer and use it in GitHub Desktop.
rAF tutorial: performance time tracking
const time = {
start: performance.now(),
total: 2000
};
const tick = now => {
time.elapsed = now - time.start;
if (time.elapsed < time.total) requestAnimationFrame(tick);
};
requestAnimationFrame(tick);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment