Canvas Tutorials

Canvas Methods and Properties

HTML canvas lineTo() Method

HTML canvas lineTo() Method



The lineTo() method adds a new point and creates a line to that point from the last specified point in the canvas.
We have to use stroke() method to actually draw the path.




Its syntax is:- context.lineTo(x,y);


Further Explanation:-


Parameter Description
x The x-coordinate of where to create the line to
y The y-coordinate of where to create the line to

Code Explanation

All Tutorials related to Canvas Methods and Properties

All Sections related to Canvas