Frame rate throttle

Hi.

I am working on a project and I want to keep the frame rate at maximum 60fps, now sometimes it running at 170 + frames on my computer.

What is the best approach for this using requestanimationframe?

https://webdesign-flash.ro/ht/pap/

Most likely this is not the best approach, but is rather straightforward and simple (I’ve used it several times):

  • the animation loop is unrestricted (in my case it was 144 fps)
  • but I call the renderer only some of the frames, whenever 1000/60 ms have ellapsed

Something like this:

if( currentTime - lastTime > 1000/60 )
{
   renderer.render( scene, camera );
   lastTime += 1000/60;
}

Thank you for your help!

Thank you for your help.

I have finished the product Plasmic Audio Player

1 Like