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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

未顯示結(jié)果?

未顯示結(jié)果?

洛黑 2016-05-01 11:33:53
<!DOCTYPE?html> <html> <head> <meta?charset="utf-8"> <title>canvas數(shù)組繪制七巧板</title> </head> <body> <canvas?id="canvas"?style="border:1px?solid?#aaa;?margin:50px?auto;?display:block;"></canvas> <script> var?tangram=[ {p:[{x:0,y:0},{x:600,y:0},{x:300,y:300}],color:"#caff67"}, {p:[{x:0,y:0},{x:300,y:300},{x:0,y:600}],color:"#67becf"}, {p:[{x:600,y:600},{x:600,y:300},{x:600,y:600},{x:600,y:150}],color:"#ef3d61"}, {p:[{x:600,y:150},{x:600,y:600},{x:300,y:300}],color:"#a594c0"}, {p:[{x:300,y:300},{x:600,y:600},{x:300,y:600},{x:150,y:600}],color:"#fa8ccc"}, {p:[{x:150,y:600},{x:300,y:600},{x:0,y:600}],color:"#f6ca29"}, {p:[{x:600,y:300},{x:600,y:600},{x:300,y:600}],color:"#f5f91a"}, ????] window.onload=function(){ ????var?canvas=document.getElementById('canvas'); ????canvas.width=600; ????canvas.height=600; ???? ????var?context=canvas.getContext("2d"); ????for(var?i=0;i<tangram.length;i++)???//數(shù)組遍歷 ???????draw(tangram[i].context); ???? } ???? function?draw(piece,cxt){ ????cxt.beginPath(); ????cxt.moveTo(piece.p[0].x,piece.p[0].y); ????for(var?i=1;i<piece.p.length;i++) ????cxt.lineTo(piece.p[i].x,piece.p[i].y); ????cxt.closePath(); ???? ????cxt.fillStyle=piece.color; ????cxt.fill(); ???? ????cxt.stroekStyle="blank"; ????cxt.lineWidth=3; ????cxt.stroke(); ????} </script> </body> </html>
查看完整描述

1 回答

?
Amumu

TA貢獻(xiàn)14條經(jīng)驗(yàn) 獲得超2個(gè)贊

善用F12調(diào)試工具,這是一個(gè)開(kāi)發(fā)人員基本技能,代碼錯(cuò)誤在


draw(tangram[i],context);,明明是兩個(gè)參數(shù),中間的逗號(hào)(,)你寫(xiě)成點(diǎn)(.)了

查看完整回答
反對(duì) 回復(fù) 2016-08-11
  • 1 回答
  • 0 關(guān)注
  • 1192 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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