HTML5 Canvas: Drawing arcs or circles

Just like any graphics program, we can draw arcs or circles.  This example illustrate how can draw an arcs.

We start with the arc method, which accepts the following values:

canvas.arc(x, y, radius, startAngle, endAngle, antiClockwise(Boolean));

Codecrawl.com: Arcs or circles

<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='utf-8'>
    <title>Codecrawl.com: Arcs or circles</title>
    <style>
        canvas {
            border: 1px solid #000;
        }
    </style>
</head>
<body>
<canvas id='canvas' width='250' height='250'></canvas>
<script>
    var canvas = document.getElementById('canvas').getContext('2d');
    canvas.arc(100, 100, 40, 5, 1, true);
    canvas.strokeStyle = '#000';
    canvas.lineWidth = 5;
    canvas.stroke();
</script>
</body>
</html>
If we set the boolean to false, this is what we get:
 
Codecrawl.com: Arcs or circles

Series Navigation<< HTML5 Canvas: Adding gradients to shape
HTML5 Canvas: Drawing a circle >>