Limiting the Animation Rate

rate( frequency )

Halts computations until 1.0/frequency seconds after the previous call to rate().

For example, rate(50) will halt computations for 1.0/50.0 second. If you place rate(50) inside a computational loop, the loop will execute only 50 times per second, even if the computer can run faster than this. This makes animations look about the same on computers of different speeds, as long as the computers are capable of carrying out 50 computations per second.