rectMode(mode);
Set rectangle alignment mode.
Arguments
mode
either CENTER
, CORNER
, RADIUS
function setup()
createWindow(200, 200);
rectMode(CENTER);
end
function draw()
background('purple');
rect(width/2, height/2, 80, 40);
point(width/2, height/2);
end
Output
function setup()
createWindow(200, 200);
rectMode(CORNER);
end
function draw()
background('purple');
rect(width/2, height/2, 80, 40);
point(width/2, height/2);
end
Output
function setup()
createWindow(200, 200);
rectMode(RADIUS);
end
function draw()
background('purple');
rect(width/2, height/2, 80, 40);
point(width/2, height/2);
end
Output