Home >Web Front-end >H5 Tutorial >html5 uses canvas to draw a picture_html5 tutorial skills

html5 uses canvas to draw a picture_html5 tutorial skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 15:47:111383browse




Copy code
The code is as follows:

var canvas=document.getElementById("canvas");
var cxt= canvas.getContext("2d");
var img=new Image();
img.src="cat.jpg";
cxt.drawImage(img,10,10,490,382);
/*
The test found a problem. The picture is often not visible when the browser is executed for the first time.
The picture can only be seen after refreshing once. Does anyone know the reason for this? Could you please tell me. Ah
.Hehe
*/

Statement:
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