Basic concepts and plotting of canvas in HTML5, html5canvas

Source: Internet
Author: User

Basic concepts and plotting of canvas in HTML5, html5canvas

* Canvas)
* Basic Content
* In short, HTML5 provides a new element <canvas>
* Canvas provides the Canvas function on the HTML page.
* Draw various images in the canvas
* The image drawn by Canvas is irrelevant to the HTML page.
* The DOM cannot be used to retrieve the drawn image.
* DOM events cannot be bound to the drawing.
* Only APIs provided by Canvas can be used.
* Canvas Purpose
* Draw charts (such as bar charts and pie charts) on the HTML page)
* Web game-Flash technology
* Use Canvas in HTML5
* How to Use Canvas
* Define the <canvas> element on the HTML page
* In javascript code
* Obtain the <canvas> element
* Create a canvas object
* GetContext ('2d ') Method
* Use the APIS provided by Canvas
* Drawing Images
* Draw a rectangle
* FillRect (x, y, width, height)-solid rectangle
* X and y-coordinate values in the upper left corner of the rectangle
* Width-set the width of the rectangle
* Height-set the height of the comet.
* StrokeRect (x, y, width, height)-hollow rectangle
* ClearRect (x, y, width, height)
* Clear the rectangle of the specified area
* Set the color.
* FillStyle-set the fill color
* StrokeStyle-set stroke color
* GlobalAlpha-set transparency (0-1)
* Set gradient
* Linear gradient-createLinearGradient (x1, y1, x2, y2)
* Baseline-start point (x1, y1) and end point (x2, y2)
* Sector (Ray) gradient-createRadialGradient (x1, y1, r1, x2, y2, r2)
* Cylindrical (conical)-area of two circles
* Parameters
* X1 and y1-coordinates of the center of the first circle
* R1-radius of the first circle
* X 2 and y2-coordinates of the center of the second circle
* R2-radius of the second 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.