Home > Web Front-end > H5 Tutorial > body text

HTML5 uses the drawImage() method to draw images_html5 tutorial tips

WBOY
Release: 2016-05-16 15:47:34
Original
1964 people have browsed it

1. Draw an image

Use the drawImage() method to draw an image. The drawing environment provides three different versions of this method.
drawImage(image,x,y): Draw the image at (x,y) in the canvas.
drawImage(image,x,y,width,height): Draw the image at (x,y) in the canvas and scale it to the specified width and height.
drawImage (image, source And draw it at (x,y) in canvas.

2. tag

Before drawing the image, you need to load the image into the browser. Here we just add an tag after the canvas tag.



3. Draw pictures

Copy the code
The code is as follows:





HTML5

< /head>



Tips: Your browser does not support the tag





4. Drawing effect

5. Attached are the original tank materials
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template