line()

Line - Draws a line segment with the given inputs

Example

line(100,100,300,300)

Syntax

line(x1, y1, x2, y2)
Input
Description

x1

x co-ordinate of the first endpoint of the line

y1

y co-ordinate of the first endpoint of the line

x2

x co-ordinate of the second endpoint of the line

y2

y co-ordinate of the second endpoint of the line

Description

line() draws a line on the canvas, using the inputs to determine the position of the 2 endpoints (the points on either end of the line segment.)

circle-info

Find these documents helpful? Let the people who made them help your child learn to code at Strivematharrow-up-right!

We'd love to hear your Feedback/Comments herearrow-up-right.

Last updated