line

Static line 

Source
pub static line: LineInternalType
Expand description

Draws a line (a direct path between two points) to the screen. If called with only 4 parameters, it will draw a line in 2D with a default width of 1 pixel. This width can be modified by using the strokeWeight() function. A line cannot be filled, therefore the fill() function will not affect the color of a line. So to color a line, use the stroke() function.

Examples

line(30, 20, 85, 75);
line(30, 20, 85, 20);
stroke(126);
line(85, 20, 85, 75);
stroke(255);
line(85, 75, 30, 75);

Overloads

x1 the x-coordinate of the first point

y1 the y-coordinate of the first point

x2 the x-coordinate of the second point

y2 the y-coordinate of the second point


x1 the x-coordinate of the first point

y1 the y-coordinate of the first point

z1 the z-coordinate of the first point

x2 the x-coordinate of the second point

y2 the y-coordinate of the second point

z2 the z-coordinate of the second point