World.frameRate
The number of times per second the screen is refreshed.
The number of times per second the screen is refreshed is also the speed of draw()
loop. frameRate is a variable that you do not need to declare. You can both read the value of frameRate and assign a new value to frameRate.
The default rate of 30 frames per second and values are limited to between 1 and 60.
Examples
Accelerate a square across the screen.
// Accelerate a square across the screen.
var rectX = 0;
World.frameRate=10;
fill("red");
function draw() {
background("white");
rectX = rectX + 1;
if (rectX >= 40) {
World.frameRate=World.frameRate*2;
rectX = 0;
}
rect(rectX, 40, 20,20);
}
Syntax
World.frameRate
Returns
Found a bug in the documentation? Let us know at support@code.org.