Course lesson

Use HTML Canvas arcTo, moveTo, and lineTo to draw a piece of a pie chart

You might think that drawing a piece of a pie possible with the .arc method. However, in this lesson, you'll see why that is impossible. Instead we must draw a pie piece with the .arcTo canvas method. .arcTo takes x1, y1, x2, y2 and radius to draw a nifty arc...

Duration
5 min
Access
Pro
Transcript
Available

You might think that drawing a piece of a pie possible with the .arc method. However, in this lesson, you'll see why that is impossible. Instead we must draw a pie piece with the .arcTo canvas method.

.arcTo takes x1, y1, x2, y2 and radius to draw a nifty arc shape. You then must use the moveTo and lineTo methods to complete the beautiful piece of a pie. As a bonus, the clearRect method is used to demonstrate clearing the canvas!