HTML canvas lineTo() Method Last Updated : 09 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The lineTo() method is used to add a new point to create a line from that point to last specified point in the canvas, Syntax: context.lineTo(x, y); Parameters: x: This parameter specifies the x-coordinate from where to create the line. y: This parameter specifies the y-coordinate from where to create the line. Example 1: html <!DOCTYPE html> <html> <head> <title> HTML canvas lineTo() Method </title> </head> <body style="text-align:left;"> <h1>GeeksforGeeks</h1> <h2>HTML canvas lineTo() Method</h2> <canvas id="GFG" width="500" height="200"> </canvas> <script> var doc_id = document.getElementById("GFG"); var context = doc_id.getContext("2d"); context.beginPath(); context.moveTo(10, 10); context.strokeStyle = 'green'; context.lineTo(200, 100); context.stroke(); </script> </body> </html> Output: Supported Browsers: The browser supported by HTML canvas lineTo() Method are listed below: Google Chrome 4.0 Internet Explorer 9.0 Firefox 3.6 Safari 4.0 Opera 10.1 Comment More info S shubham_singh Follow Improve Article Tags : Web Technologies HTML HTML-Methods Explore HTML BasicsHTML Introduction5 min readHTML Editors5 min readHTML Basics7 min readStructure & ElementsHTML Elements5 min readHTML Attributes8 min readHTML Headings4 min readHTML Paragraphs5 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists5 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks3 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables10 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics6 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List15+ min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like