While there are definitely better versions, as always I’m concerned with the fundamental function – and for requestAnimationFrame it’s pretty straightforward: