What is Canvas?
The HTML5 <canvas> element is
used to draw graphics, on the fly,
via scripting (usually JavaScript).
Browser Support
• Internet Explorer 9+, Firefox, Opera,
Chrome, and Safari
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>
• To draw a line using HTML5 Canvas, we
can use the beginPath(), moveTo(),
lineTo(), and stroke() methods.
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().
context.beginPath();
context.moveTo(100, 150);
context.lineTo(450, 50);
context.lineWidth = 15;
context.stroke();
HTML5 Canvas Line Color
// set line color
context.strokeStyle = '#ff0000';
context.stroke();
Thanks

http://www.gratisan.com
http://jogjawebcenter.com

Canvas - HTML 5