Prev Demo
HTML5
>
Paths
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Lineto</title> </head> <body> <canvas id="myCanvas" width="578" height="200"></canvas> <script> var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); context.beginPath(); context.moveTo(100, 150); context.lineTo(250, 50); context.lineWidth = "10"; context.strokeStyle = "green"; context.stroke(); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output