background();
Clear a background with a color.
background(r, g, b);
Arguments
r
The red byteg
The green byteb
The blue byte background(100, 255, 100);
background(r, g, b, a);
Arguments
r
The red byteg
The green byteb
The blue bytea
The alpha byte background(100, 255, 100, 150);
background(v);
Arguments
v
The grayscale value background(100);
background(color_name);
Arguments
color_name
The color name background('yellow');
background(hex);
Arguments
hex
The hex color string background('#88EE66');
fill();
Set the fill color for shapes.
fill(r, g, b);
Arguments
r
The red byteg
The green byteb
The blue byte fill(100, 255, 100);
fill(r, g, b, a);
Arguments
r
The red byteg
The green byteb
The blue bytea
The alpha byte fill(100, 255, 100, 150);
fill(v);
Arguments
v
The grayscale value fill(100);
fill(color_name);
Arguments
color_name
The color name fill('yellow');
fill(hex);
Arguments
hex
The hex color string fill('#88EE66');
strokeWeight(weight);
Set the line width.
Arguments
weight
The line width in pixelsstrokeWeight(8);
line(200, 200, mouseX, mouseY);
stroke();
Set the stroke color for shapes
stroke(r, g, b);
Arguments
r
The red byteg
The green byteb
The blue byte stroke(255, 255, 100);
stroke(r, g, b, a);
Arguments
r
The red byteg
The green byteb
The blue bytea
The alpha byte stroke(255, 255, 100, 150);
stroke(v);
Arguments
v
The grayscale value stroke(255);
stroke(color_name);
Arguments
color_name
The 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);
end
function 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);
end
pop();
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
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
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 true
function setup()
createWindow(800, 800, GL3D);
debugMode();
end
function draw()
background('purple');
box(100);
end
function 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