<canvas id="canvas" width="300" height="300"></canvas>This declaration creates the canvas on which we'll draw in the rest of the tutorial.
Now that we've got a canvas to draw on, let's do so:
You may want to comment out the arc(...)
call and try
ctx.rect(x, y, width, height)
.
Make sure you keep the arc and rect calls in between calls to
beginPath()
and closePath()
just like the
sample call above. You may also try substituting stroke()
for fill()
.