最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

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

為什么我的星星沒(méi)有填充色呢

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

</head>

<style>

#canvas{display: block; border: 1px solid black; margin: 60px auto;}

</style>

<body>

<canvas id="canvas">

</canvas>

<script type="text/javascript">

window.onload = function(){

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

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

canvas.width = 800;

canvas.height = 800;

context.fillRect(0,0,canvas.width,canvas.height)

//一個(gè)畫(huà)布中開(kāi)始子路徑的一個(gè)新的集合

drawStar(context,150,300,400,400,30);

}

//cxt:繪制環(huán)境 ? r:小圓半徑 ? R:大圓半徑 ? x,y:圖像的位置 ? rot:旋轉(zhuǎn)的角度

function drawStar(cxt,r,R,x,y,rot){

cxt.beginPath();

for (var i=0 ; i<5 ; i++) {

//大圓

cxt.lineTo(Math.cos((18+i*72-rot)/180*Math.PI )*R + x ,

? ? ? ? ? ? ? -Math.sin((18+i*72-rot)/180*Math.PI )*R + y)

//小圓

cxt.lineTo(Math.cos((54+i*72-rot)/180*Math.PI )*r + x ,

? ? ? ? ? ? ? -Math.sin((54+i*72-rot)/180*Math.PI )*r + y)

}

? ? ? ? ? ? //一個(gè)畫(huà)布中結(jié)束子路徑的一個(gè)新的集合

? cxt.closePath();

?

? ? ?cxt.fillStyle = "#fb3";

? ? ?cxt.strokeStyle = "#fd5";

? cxt.lineWidth = 3;

? cxt.lineJoin = 'round';

?

?

? //畫(huà)弧

? cxt.stroke();

}

</script>

</body>

</html>


正在回答

2 回答

?//畫(huà)弧

? cxt.stroke();

在這之前添加cxt.fill();

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

因?yàn)槟銢](méi)有寫(xiě) cxt.fill()?

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

舉報(bào)

0/150
提交
取消
Canvas繪圖詳解
  • 參與學(xué)習(xí)       73016    人
  • 解答問(wèn)題       441    個(gè)

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

進(jìn)入課程

為什么我的星星沒(mé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)