為什么要把canvas的寬高放在draw里面,放在標(biāo)簽上為毛不行呢
?? ??? ??? ?canvas.width=1024;
?? ??? ??? ?canvas.height=800;
?? ??? ??? ?ctx.clearRect(0,0,canvas.width,canvas.height);
?? ??? ??? ?ctx.fillStyle="#f60";
?? ??? ??? ?ctx.beginPath();
?? ??? ??? ?ctx.moveTo(100,100);
?? ??? ??? ?ctx.lineTo(400,100);
?? ??? ??? ?ctx.lineTo(80,200);
?? ??? ??? ?ctx.closePath();
?? ??? ??? ?ctx.fill();
?? ??? ??? ?ctx.globalCompositeOperation=gco;
?? ??? ??? ?ctx.fillStyle='green';
?? ??? ??? ?ctx.fillRect(100,100,100,200);
?? ??? ?}
2015-10-29
明顯可以的