HTML5 Canvas labels for daily training-draw a circle-

Source: Internet
Author: User
In the previous section, we learned how to use Canvas to draw a rectangle. Is it still the same if you want to draw a circle? Steps to draw a circle: some steps are similar to the rectangle drawn in the previous section. If you do not see the content of this section, click here-HTML5 daily practice ...,. HTML5 Canvas tag application for daily training-draw a circle

In the previous section, we learned how to use Canvas to draw a rectangle. Is it still the same if you want to draw a circle?

To draw a circle:

Some steps are similar to the rectangle drawn in the previous section, so we will not repeat them here. If you do not see the content in the section, click here -- HTML5 Canvas tag application-draw a rectangle.

1. Create a path
First, use the beginPath () method of the graphic context object.

2. Create a circular path
When creating a circular path, you must use the arc () method of the circular context object.
Arc (x, y, radius, startAngle, endAngle, anticlockwise );
X: the abscissa of the starting point.
Y: The ordinate of the start point.
Radius: indicates the circular radius.
StartAngle: indicates the start angle.
EndAngle: indicates the end angle.
Anticlockwise: Indicates whether to draw clockwise, boolean Type

3. Close the path
After creating a path, use the closePath () method of the graphic context object to disable the path.

4. Draw a Graphic Style
I don't want to say much about this.

Case

            
         HTML5 Canvas tag application for daily training-draw a circle        

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.