frameRate()

Examples

void setup() {
  frameRate(4);
}

int pos = 0;

void draw() {
  background(255);
  pos++;
  line(pos, 20, pos, 80);
  if (pos > sketchWidth) {
    pos = 0;
  }
}

Description

Specifies the number of frames to be displayed every second. For example, the function call frameRate(10) will attempt to refresh 10 times a second. If the processor is not fast enough to maintain the specified rate, the frame rate will not be achieved. The default rate is 1 frames per second.

Syntax

frameRate(fps)

Parameters

fps float: number of desired frames per second

Returns

void

Related

frameCount
loop()
noLoop()
redraw()

Back to index