Code
Execute
<!DOCTYPE html> <html> <head> <title>wikitechy-HTML Canvas beginpath </title> </head> <body> <h1>wikitechy HTML Canvas beginpath with example </h1> <canvas id="wikitechyCanvas" width="400" height="200" style="border:1px solid #d3d3d3;"></canvas> <script> var m = document.getElementById("wikitechyCanvas"); var mak = m.getContext("2d"); mak.beginPath(); mak.lineWidth = "10"; mak.strokeStyle = "red"; mak.moveTo(50, 80); mak.lineTo(300, 85); mak.stroke(); mak.beginPath(); mak.strokeStyle = "black"; mak.moveTo(55, 25); mak.lineTo(300, 140); mak.stroke(); </script> </body> </html>
Result