特别来记录一下canvas绘制图像,要在图片加载完后,才会将其显示在canvas画布之上,否则会显示不出来:深刻体会,愣是找不到问题... var c=document.getElementById("cvs"); var ctx=c.getContext("2d"); var imgX = 10; var imgY = 10; var img = new Image(); img.src = 'images/icon.png'; // 待图片加载完后,将其显示在c
图像篇: 代码: 1 /** 2 * Created by Administrator on 2016/1/28. 3 */ 4 function draw (id){ 5 var canvas = document.getElementById(id); 6 var context = canvas.getContext("2d"); 7 var newImg = new Image(); 8 newImg.src = "女孩.jpg"; 9 newImg.onl