Name | line |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Examples |
# line 2 https://processing.org/reference/line_.html line(30, 20, 85, 20) stroke(126) line(85, 20, 85, 75) stroke(255) line(85, 75, 30, 75) # line 1 https://processing.org/reference/line_.html line(30, 20, 85, 75) # line 3 https://processing.org/reference/line_.html # Drawing lines in 3D requires P3D as a parameter to size() settings <- function() { size(100, 100, P3D) } setup <- function() { } draw <- function() { line(30, 20, 0, 85, 20, 15) stroke(126) line(85, 20, 15, 85, 75, 0) stroke(255) line(85, 75, 0, 30, 75, -50) } | ||||||||||||
Description | Draws a line (a direct path between two points) to the screen. The version of line() with four parameters draws the line in 2D. To color a line, use the stroke() function. A line cannot be filled, therefore the fill() function will not affect the color of a line. 2D lines are drawn with a width of one pixel by default, but this can be changed with the strokeWeight() function. The version with six parameters allows the line to be placed anywhere within XYZ space. Drawing this shape in 3D with the z parameter requires the P3D parameter in combination with size() as shown in the above example. | ||||||||||||
Syntax | line( | ||||||||||||
Parameters |
| ||||||||||||
Related |
strokeWeight strokeJoin strokeCap PShape_beginShape |
Cover
Reference
Tutorials
Bugs