line()Shape2D PrimitivesWeb & Applicationline_.gif
line(30, 20, 85, 75);
line_2.gif
line(30, 20, 85, 20);
stroke(126);
line(85, 20, 85, 75);
stroke(255);
line(85, 75, 30, 75);
A line is a direct path between two points. The version of line() with four parameters draws the line in the XY plane at Z=0. The version with six parameters allows the line to be placed anywhere within XYZ space. To color a line, use the stroke() function. A line cannot be filled, therefore the fill() method will not affect the color of a line. Lines are drawn with a width of one pixel.
line(x1, y1, x2, y2);
line(x1, y1, z1, x2, y2, z2);
int or float: x-coordinate of the first pointint or float: y-coordinate of the first pointint or float: z-coordinate of the first pointint or float: x-coordinate of the second pointint or float: y-coordinate of the second pointint or float: z-coordinate of the second pointNone
beginShape()
1.0FunctionCore