line(x1, y1, x2, y2);
Draw a line on the screen.
Arguments
x1
The x position of the first pointy1
The y position of the first pointx2
The x position of the second pointy2
The y position of the second pointfunction setup()
createWindow(200, 200);
end
function draw()
background('purple');
stroke('white');
-- diagonal line from top-left to mouse pointer
line(0, 0, mouseX, mouseY);
end
Output