ixfx
    Preparing search index...

    Function fpsCounter

    • Calculates frames per second.

      Returns a function which needs to be called at the end of each frame.

      const fps = fpsCounter();

      function loop() {
      fps(); // Calculate fps
      window.requestAnimationFrame(loop);
      }

      loop();

      Parameters

      • autoDisplay: boolean = true

        If true (default), prints out the FPS to the console

      • computeAfterFrames: number = 500

        Calculates after this many frames. Higher numbers smoothes the value somewhat

      Returns () => number