第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

關(guān)于星星重疊問題

var?ss=new?Array();
for(var?p=0;p<50;p++){
????var?r=Math.random()*10+10;
????var?x=Math.random()*can.width;
????var?y=Math.random()*can.height;
????var?rott=Math.random()*360;
????ss.push([r,x,y]);

????if?(Math.sqrt(Math.pow(ss[0][1]-x,2)+Math.pow(ss[0][2]-y,2))>ss[0][0]+r){
????????kk(tex,r,r/2,x,y,rott);
????}
}

function?kk(tex,R,r,x,y,rot)?{
????tex.lineWidth=10;
????tex.beginPath();
????for(var?i=0;i<5;i++){
????????tex.lineTo(Math.cos((18+i*72-rot)/180*Math.PI)*R+x,-Math.sin((18+i*72-rot)/180*Math.PI)*R+y);
????????tex.lineTo(Math.cos((54+i*72-rot)/180*Math.PI)*r+x,-Math.sin((54+i*72-rot)/180*Math.PI)*r+y);
????}
????tex.closePath();
????tex.fillStyle='#fb3';
????tex.strokeStyle='#fb5';
????tex.lineWidth=10;
????tex.lineJoin='round';
????tex.fill();
????tex.stroke();
}


正在回答

1 回答

這樣不行吧??

if?(Math.sqrt(Math.pow(ss[0][1]-x,2)+Math.pow(ss[0][2]-y,2))>ss[0][0]+r){
????????kk(tex,r,r/2,x,y,rott);
????}
????不是應(yīng)該與前面生成的所有坐標都進行比較嗎?你這樣貌似只比較了第一個生成的坐標與當(dāng)前坐標的距離大于直徑


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
Canvas繪圖詳解
  • 參與學(xué)習(xí)       72988    人
  • 解答問題       434    個

Canvas系列教程第二課,詳解Canvas各接口,讓同學(xué)徹底掌握Canvas繪圖

進入課程

關(guān)于星星重疊問題

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號