两个draw的参数有何区别
window.onload=function(){
var canvas=document.getElementById("canvas");
canvas.width=WINDOW_WIDTH;
canvas.height=WINDOW_HEIGHT;
var context=canvas.getContext("2d");
for(var i=0;i<tangram.length;i++){
draw(tangram[i],context)
}
function draw(pice,cxt){
cxt.beginPath();
cxt.moveTo(pice.p[0].x,pice.p[0].y)
for(var i=0;i<pice.p.length;i++){
cxt.lineTo(pice.p[i].x,pice.p[i].y)
}
cxt.closePath();
cxt.fillStyle=pice.color;
cxt.fill();
}