q5play
    Preparing search index...

    Function frameRate

    • 💻 Sets the target frame rate or gets an approximation of the sketch's current frame rate.

      Even when the sketch is running at a consistent frame rate, the current frame rate value will fluctuate. Use your web browser's developer tools for more accurate performance analysis.

      Parameters

      • Optionalhertz: number

        target frame rate, default is 60

      Returns number

      current frame rate

      q5.draw = function () {
      background(0.8);

      if (mouseIsPressed) frameRate(10);
      else frameRate(60);

      circle((frameCount % 200) - 100, 0, 80);
      };
      q5.draw = function () {
      background(0.8);
      textSize(64);
      text(round(frameRate()), -35, 20);
      };