Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

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

    htmlHTML 5

    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!