Can someone please share where you should have the RequestAnimationFrame call in the animation loop. Should it be at the beginning of the loop or the end of the loop? I've seen it written about many times with it at the beginning of the loop but wouldn't it be better to be at the bottom of the loop so it won't be called while it might still be processing? Or does the RequestAnimationFrame have a check to see if it is already running and not run it if it is running already? Or does it not matter at all? I've tried moving it around and haven't noticed any changes in my code.
Eg Top:
function gameLoop() {
RequestAnimationFrame(gameLoop);
renderFrameHere();
}
Eg Bottom:
function gameLoop() {
renderFrameHere();
RequestAnimationFrame(gameLoop);
}
Thank you,