November 2011
Intermediate to advanced
348 pages
7h 2m
English
Although the HTML5 canvas API doesn't support a circle method, we can certainly create one by drawing a fully enclosed arc.

Follow these steps to draw a circle centered on the canvas:
window.onload = function(){
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");arc() method, set the color fill using the fillStyle property, and then fill the shape with the fill() method:context.arc(canvas.width / 2, canvas.height / 2, 70, 0, 2 * Math.PI, false); context.fillStyle = "#8ED6FF"; context.fill(); context.lineWidth = 5; context.strokeStyle ...
Read now
Unlock full access