/

HTML / CSS / JavaScript Tutorial

JavaScript canvas2d object method: lineTo()

[this page | pdf | back links]

The lineTo() method of the JavaScript DOM object returned by the getContext("2d") method applied to the HTML <canvas> element moves the path to a specified point in the canvas, creating a line from the previous point.

 

It has the following syntax with the following parameters.

 

context.lineTo(x, y)

 

Parameter

Required / Optional

Description

x

Required

x-coordinate of point

y

Required

y-coordinate of point

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile