Skip to content

Instantly share code, notes, and snippets.

@itsMapleLeaf
Last active June 8, 2023 01:45
Show Gist options
  • Save itsMapleLeaf/c20b59b100ad9b5f5525cd897de79743 to your computer and use it in GitHub Desktop.
Save itsMapleLeaf/c20b59b100ad9b5f5525cd897de79743 to your computer and use it in GitHub Desktop.
async function loop() {
let currentTime = performance.now()
while (true) {
const nextTime = await animationFrame()
const delta = nextTime - currentTime
// progress += delta
currentTime = nextTime
}
}
const animationFrame = () => new Promise((resolve) => requestAnimationFrame(resolve))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment