亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

請問為什么月亮變成了一個大半圓?用stroke畫出來沒問題,一填色就是半圓

function drawMoon(cxt,x,y,R,rot){
?? ??? ?cxt.save();
?? ??? ?cxt.translate(x,y);
?? ??? ?cxt.scale(R,R);
?? ??? ?cxt.rotate(rot/180*Math.PI);
?? ??? ?moonPath(cxt);
?? ??? ?cxt.fillStyle = "white";
?? ??? ?cxt.fill();
?? ??? ?cxt.restore();
?? ?}

?? ?function moonPath(cxt){
?? ? ?? cxt.beginPath();
?? ??? ?cxt.arc(0,0,1,1.5*Math.PI,0.5*Math.PI,false);
?? ??? ?cxt.moveTo(0,-1);
?? ??? ?cxt.arcTo(1.2,0,0,1,dis(1.2,0,0,-1)/1.2);
?? ??? ?cxt.closePath();

??? }

?? ?function dis(x1,y1,x2,y2){
?? ??? ?return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
?? ?}

正在回答

2 回答

?cxt.arc(0,0,1,1.5*Math.PI,0.5*Math.PI,false);

最后一個參數改成true

0 回復 有任何疑惑可以回復我~

cxt.arc(0,0,1,0.5*Math.PI,1.5*Math.PI,true);

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

請問為什么月亮變成了一個大半圓?用stroke畫出來沒問題,一填色就是半圓

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號