Skip to content

Instantly share code, notes, and snippets.

@vincentmvdm
Last active July 16, 2019 01:01
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 vincentmvdm/11765d22d310993fa78801dec18faef7 to your computer and use it in GitHub Desktop.
Save vincentmvdm/11765d22d310993fa78801dec18faef7 to your computer and use it in GitHub Desktop.
const data = Data({
elapsedMs: 0,
})
let startTime = null
function timer(timestamp) {
if (!startTime) startTime = timestamp
data.elapsedMs = timestamp - startTime
if (data.elapsedMs < 48000) {
window.requestAnimationFrame(timer)
}
}
window.requestAnimationFrame(timer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment