After creating the DOM, I implemented a basic requestAnimationFrame
loop that starts right away. In this loop, I needed to utilize the time argument passed to the callback function. However, I noticed that the time value is incorrect during the first few frames when running the code on Firefox. Here's what I observed:
function loop(time) {
console.log(time);
// implement animation based on the time
requestAnimationFrame(loop);
}
requestAnimationFrame(loop);
https://i.sstatic.net/Znm5T.png
To workaround this issue, I added a simple condition to skip the initial 3 frames. But I'm curious as to why this behavior occurs in the first place.