Description
Draws a line (a direct path between two points) to the screen. 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.
Syntax
Parameters
x1 – x-coordinate of the first point, 0 to 319
y1 – y-coordinate of the first point, 0 to 239
x2 – x-coordinate of the second point, 0 to 319
y2 – y-coordinate of the second point, 0 to 239
Returns
none
Example
1
2
3
4
5
6
7
8
9
10
11
12
|
<br>// Fill up screen with random colored, random lines
<br>void setup()
<br> {
<br> background(0,0,0); //this paints the whole background black
<br>}
<br>
<br>void loop()
<br>{
<br> stroke(random(255),random(255),random(255));
<br> line(random(320),random(240),random(320),random(240));
<br>} |
Related
none