 |
 |
 |
 |
Name |
|
line() |
 |
|
|
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);
|
 |
|
Description |
|
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. |
 |
|
|
Syntax |
|
line(x1, y1, x2, y2);
line(x1, y1, z1, x2, y2, z2);
|
 |
|
|
Parameters |
|
x1 |
|
int or float: x-coordinate of the first point
|
y1 |
|
int or float: y-coordinate of the first point
|
z1 |
|
int or float: z-coordinate of the first point
|
x2 |
|
int or float: x-coordinate of the second point
|
y2 |
|
int or float: y-coordinate of the second point
|
z2 |
|
int or float: z-coordinate of the second point
|
|
 |
|
|
Returns |
|
None |
 |
|
|
Usage |
|
Web & Application |
 |
|
|
Related |
|
beginShape() |
|