Code
Execute
<!DOCTYPE html> <html> <head> <title>wikitechy-HTML canvas stroke() method </title> </head> <body> <h1>wikitechy-HTML canvas stroke() method with example:</h1> <canvas id="wikitechyCanvas" width="400" height="200" style="border:1px solid #d3d3d3;"></canvas> <script> var a = document.getElementById("wikitechyCanvas"); var art= a.getContext("2d"); art.moveTo(40,40); art.lineTo(100, 40); art.lineTo(80, 120); art.strokeStyle = "rgb(0,100,220)"; art.stroke(); </script> </body> </html>
Result