Skip to main content

line

Description

Draws a line (a direct path between two points) to the screen. Lines are drawn 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.

Syntax

line(x1, y1, x2, y2)

Parameters

ParameterDescription
x1x-coordinate of the first point
y1y-coordinate of the first point
x2x-coordinate of the second point
y2y-coordinate of the second point