Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

p5.js | frameRate() Function

  • Last Updated : 09 Jul, 2019

The frameRate() function in p5.js is used to specify the number of frames to be displayed every second. Calling frameRate() with no arguments returns the current framerate. The draw function must run at least once before it will return a value. This function is same as getFrameRate() function.


Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

frameRate( c )

Parameters: The function accepts single parameter c which stores the value of frame rate variable.

Below program illustrates the frameRate() function in p5.js:


function setup() {
    // Create canvas of given size
    createCanvas(500, 200);
    // Set the font size
    // Use frameRate() function
function draw() {
    // Set the background color
    background(0, 153, 0);
    // Display the output
    text("Frame Count with frameRate "
         int(getFrameRate()), 100, 100);



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!