1.画布上可以画很多东西。
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.shadowBlur=50;
ctx.fillStyle="blue";
ctx.shadowColor="black";
ctx.fillRect(20,20,100,80);
ctx.shadowColor="red";
ctx.fillRect(140,20,100,80);
2.如果需要在同一块画布上画不同颜色的填充,beginPath() 和 closePath() ,这两
个函数可以起到类似div的作用,用它来把每个圆圈包围,就可以绘制不同颜色的图形了。
http://blog.csdn.net/shao_winds/article/details/9131839

网友评论