Home >Web Front-end >H5 Tutorial >HTML5 uses the drawImage() method to draw images_html5 tutorial tips
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