drawMoon(context,2,200,200,150,30);
function drawMoon(cxt,d,x,y,r,rot){
cxt.save();
cxt.translate(x,y);
cxt.scale(R,R);
cxt.rotate(rot*Math.PI/180);
moon(cxt,d);
cxt.fillStyle = "#fb5";
cxt.fill();
cxt.restore();
}
function moon(cxt,d){
cxt.beginPath();
cxt.arc(0,0,1,0.5*Math.PI,Math.PI*1.5,true);
cxt.moveTo(0,-1);
cxt.arcTo(d,0,0,1,dis(0,-1,d,0)/d);
cxt.closePath();
}
function dis(x1,x2,y1,y2){
return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
cxt.scale(R,R); 哪来的R???