4. HTML5 Canvas Template
<body>
<canvas id="myCanvas" width="500"
height="250"></canvas>
<script>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
// do stuff here
</script>
</body>
5. • To draw a line using HTML5 Canvas, we
can use the beginPath(), moveTo(),
lineTo(), and stroke() methods.
6.
7.
8. HTML5 Canvas Line Width
Tutorial
• To define the width of an HTML5 Canvas
line, we can use the lineWidth property of
the canvas context. The lineWidth
property must be set before calling
stroke().