We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › frameRate()
Page Index Toggle Pages: 1
frameRate() (Read 526 times)
frameRate()
Sep 21st, 2007, 11:18pm
 
I found in the new book that draw() function include 'frameRate(n)' unlike the examples of the tutorial of this processing site (which include it in setup() funtion).
Is there any difference between them?
Re: frameRate()
Reply #1 - Oct 1st, 2007, 5:27pm
 
You can adjust the frame rate where you want in your sketch, which means you can call the frameRate() method in setup() or draw(), depending on what you want to do.

Just put it in the setup() if you want it to be fixed :

void setup() {
 frameRate(30);
}

If you want it to change, say depending on the mouse's position, you can put it in the draw() method :

void draw() {
 frameRate(mouseX);
 background(random(255));
}

Nicolas.
Page Index Toggle Pages: 1