line(x1, y1, x2, y2);Draw a line on the screen.
Arguments
x1The x position of the first pointy1The y position of the first pointx2The x position of the second pointy2The 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);
endOutput