background();Clear a background with a color.
background(r, g, b);Arguments
rThe red bytegThe green bytebThe blue byte background(100, 255, 100);background(r, g, b, a);Arguments
rThe red bytegThe green bytebThe blue byteaThe alpha byte background(100, 255, 100, 150);background(v);Arguments
vThe grayscale value background(100);background(color_name);Arguments
color_nameThe color name background('yellow');background(hex);Arguments
hexThe hex color string background('#88EE66');fill();Set the fill color for shapes.
fill(r, g, b);Arguments
rThe red bytegThe green bytebThe blue byte fill(100, 255, 100);fill(r, g, b, a);Arguments
rThe red bytegThe green bytebThe blue byteaThe alpha byte fill(100, 255, 100, 150);fill(v);Arguments
vThe grayscale value fill(100);fill(color_name);Arguments
color_nameThe color name fill('yellow');fill(hex);Arguments
hexThe hex color string fill('#88EE66');strokeWeight(weight);Set the line width.
Arguments
weightThe line width in pixelsstrokeWeight(8);
line(200, 200, mouseX, mouseY);stroke();Set the stroke color for shapes
stroke(r, g, b);Arguments
rThe red bytegThe green bytebThe blue byte stroke(255, 255, 100);stroke(r, g, b, a);Arguments
rThe red bytegThe green bytebThe blue byteaThe alpha byte stroke(255, 255, 100, 150);stroke(v);Arguments
vThe grayscale value stroke(255);stroke(color_name);Arguments
color_nameThe color name stroke('red');push();Save the style and transformation settings.
Pushes the lu5 style settings off the stack.
Pushes the OpenGL transformation matrix off the stack.
function setup()
createWindow(400, 400);
end
function draw()
background('purple');
push();
fill(155, 255, 0);
strokeWeight(12);
-- Affected by style
circle(300, 200, 32);
pop();
-- Not Affected by style
circle(100, 200, 32);
endfunction setup()
createWindow(400, 400);
end
function draw()
background('purple');
push();
fill('red');
translate(200, 200);
-- Affected by transformation
circle(0, 0, 32);
pop();
-- Not Affected by transformation
circle(0, 0, 32);
endpop();Restore the style and transformation settings.
Pops the lu5 style settings off the stack.
Pops the OpenGL transformation matrix off the stack.
rectMode(mode);Set rectangle alignment mode.
Arguments
modeeither CENTER, CORNER, RADIUSfunction setup()
createWindow(200, 200);
rectMode(CENTER);
end
function draw()
background('purple');
rect(width/2, height/2, 80, 40);
point(width/2, height/2);
endOutput
function setup()
createWindow(200, 200);
rectMode(CORNER);
end
function draw()
background('purple');
rect(width/2, height/2, 80, 40);
point(width/2, height/2);
endOutput
function setup()
createWindow(200, 200);
rectMode(RADIUS);
end
function draw()
background('purple');
rect(width/2, height/2, 80, 40);
point(width/2, height/2);
endOutput
debugMode([enable]);Toggle a helpful mode with 3D Graphics.
Arguments
[enable]Whether or not to enable the debug mode, if not provided, it defaults to truefunction setup()
createWindow(800, 800, GL3D);
debugMode();
end
function draw()
background('purple');
box(100);
endfunction setup()
createWindow(800, 800, GL3D);
end
function draw()
background('purple');
-- When the d key is down, show debug graphics
if (keyIsDown('d')) then
debugMode(true);
else
debugMode(false);
end
box(100);
end