Should I use a request animation frame if I force it to continue 25 FPS. This is why I ask:
Normal RAF behavior: a1000ms / 60 fps = 16.66a This is the standard refresh rate for most monitors.
Removing FPS up to 30:
1000 / 30 = 33.33 , which is exactly half of 60, and this means that any other RAF execution will do something logical and consistent
Reduced FPS to 25:
1000 / 25 = 40 this is not divided by 16.66 (normal RAF time for updating the screen)
With this logic, I will have to draw something on the screen every 40 ms, but this is not possible, because one frame is 16.66.
I lower the number of frames by standard:
fps = 25, renderRate = 1000 / fps, function animation(timestamp) { draw.requestAnimationFrame = requestAnimationFrame(animation); now = timestamp; elapsed = now - then; if (elapsed > renderRate) { then = now - (elapsed % renderRate); //Some code for execution goes here } }
source share