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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

程序感覺(jué)沒(méi)錯(cuò),就是出不來(lái)矩形

<script type="text/javascript">

window.onload=function(){

var canvas=document.getElementById("canvas");

canvas.width=800;

canvas.height=800;

var context=canvas.getContext("2d");

drawRect(context,100,100,400,400,"#046","pink");

drawRect1(context,300,300,300,300,"#000","red");

drawRect2(context,400,400,300,300,"#abc","blue");

}

function drawRect(cxt,x,y,width,height,borderColor,fillColor){

cxt.beginPath();

cxt.moveTo(x,y);

cxt.lineTo(x+width,y);

cxt.lineTo(x+width,y+height);

cxt.lineTo(x,y+height);

cxt.closePath();

cxt.lineWidth = borderWidth;

cxt.fillStyle = fillColor;

cxt.strokeStyle = borderColor;

cxt.fill();

cxt.stroke();

}

function drawRect1(cxt,x,y,width,height,borderColor,fillColor){

cxt.beginPath();

cxt.rect(x,y,width,height);

cxt.closePath();

cxt.lineWidth=borderWidth;

cxt.fillStyle=fillColor;

cxt.strokeStyle=borderColor;

cxt.fill();

cxt.stroke();

}

function drawRect2(cxt,x,y,width,height,borderColor,fillColor){


cxt.lineWidth=borderWidth;

cxt.fillStyle=fillColor;

cxt.strokeStyle=borderColor;

cxt.fillRect(x,y,width,height);

cxt.strokeRect(x,y,width,height);

}

</script>


正在回答

3 回答

應(yīng)該這樣:


function drawRect(cxt,x,y,width,height,borderWidth,borderColor,fillColor){


cxt.beginPath();


cxt.moveTo(x,y);


cxt.lineTo(x+width,y);


cxt.lineTo(x+width,y+height);


cxt.lineTo(x,y+height);


cxt.closePath();


cxt.lineWidth = borderWidth;


cxt.fillStyle = fillColor;


cxt.strokeStyle = borderColor;


cxt.fill();


cxt.stroke();


}


調(diào)用:drawRect(context,100,100,400,400,10,"#046","pink");


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

drawRect里面 cxt.lineWidth = borderWidth; borderWidth 你沒(méi)設(shè)值

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

drawRect里面你沒(méi)有寫borderWidth及其值,你看看是不是

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

舉報(bào)

0/150
提交
取消

程序感覺(jué)沒(méi)錯(cuò),就是出不來(lái)矩形

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

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

幫助反饋 APP下載

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

公眾號(hào)

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