HTML5 draw a rectangle in the canvas with an effect map _ html5 tutorial skills-

Source: Internet
Author: User
You can use the rectangle drawing function of the drawing environment to draw a rectangle fillRect to draw a solid rectangle, strokeRect to draw a hollow rectangle, and clearRect to clear the specified rectangular area to make it completely transparent, the sample code is as follows: 1. Draw a rectangle

Canvas uses the coordinate system of the origin () in the upper left corner. The x coordinates increase to the right, and the y coordinates increase downward.

Use the rectangle drawing function of the drawing environment to draw a rectangle.

FillRect (x, y, width, height): draws a solid rectangle.
StrokeRect (x, y, width, height): draws a hollow rectangle.
ClearRect (x, y, width, height): clears the specified rectangular area to make it completely transparent.

2. Draw a rectangle in the canvas

The Code is as follows:







HTML5

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.