I am creating a html5 canvas game and want to check how many frames pass in one second. I have tried using new Date(), and it is not working. How would I manage to do this? javascript template/example:
var fps;
function loop(){
//some code
window.requestAnimationFrame(loop);
}
function checkFrameRate(){
fps = //how long it takes for loop to run
window.requestAnimationFrame(checkFrameRate);
}
loop();
checkFrameRate