Time
Time Functions
onTimer
onTimer
Registers a function that listens for timer events. Your listener function will be called over and over after the end of each timed interval.
listenerFunction
*
function
the name of the listener function that you wrote. Takes one input, the world.
interval
*
number
the interval between calls to the listener function, measured in milliseconds
Returns
nothing
getElapsedTime
getElapsedTime
Returns the elapsed time, in milliseconds, since the animation started.
Returns
number
the elapsed time, measured in milliseconds
resetTime
resetTime
Resets the elapsed time that is used by getElapsedTime
.
Returns
nothing
setFrameRate
setFrameRate
Sets the desired frame rate (in frames per second) for the animation. If you specify a frame rate that is too high, your animation may run at a slower frame rate as limited by your graphics hardware. The frame rate defaults to 60 frames per second.
framerate
*
number
-
The frame rate that you want (in frames per second)
Returns
nothing
displayFPS
displayFPS
Makes your program display the actual frame rate (in frames per second) in the Python Shell window every few seconds as your program runs.
interval
*
number
-
The number of seconds between FPS reports. Use 0 to disable displaying FPS values.
Returns
nothing
getActualFrameRate
getActualFrameRate
Returns current frame rate, in frames per second, of your program. This may be lower than the frame rate you asked for if your program has too much work to do during each frame and can’t keep up.
Returns
number
The frame rate in FPS (frames per second)
Last updated