We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
第585天 使用canvas画一个五子棋的棋盘
3+1官网
我也要出题
The text was updated successfully, but these errors were encountered:
CSS样式: #wrap{ width: 100%; height:100vh; text-align: center; } #myCanvas{ margin-top:50px; cursor: pointer; background: #f3b14d; }
#wrap{ width: 100%; height:100vh; text-align: center; } #myCanvas{ margin-top:50px; cursor: pointer; background: #f3b14d; }
HTML标签: <div id="wrap"> <canvas id="myCanvas" width="640" height="640"></canvas> </div>
<div id="wrap"> <canvas id="myCanvas" width="640" height="640"></canvas> </div>
JS:
var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext("2d"); //画标点 ctx.beginPath(); ctx.arc(160,160,5,0,2*Math.PI); ctx.arc(320,160,5,0,2*Math.PI); ctx.arc(480,160,5,0,2*Math.PI); ctx.fill(); ctx.closePath(); ctx.beginPath(); ctx.arc(160,320,5,0,2*Math.PI); ctx.arc(320,320,5,0,2*Math.PI); ctx.arc(480,320,5,0,2*Math.PI); ctx.fillStyle = "#000"; ctx.fill(); ctx.closePath(); ctx.beginPath(); ctx.arc(160,480,5,0,2*Math.PI); ctx.arc(320,480,5,0,2*Math.PI); ctx.arc(480,480,5,0,2*Math.PI); ctx.fillStyle = "#000"; ctx.fill(); ctx.closePath(); //画棋盘 for (i = 40; i < 640; i += 40) { ctx.beginPath(); ctx.moveTo(40, i); ctx.lineTo(600, i); ctx.closePath(); ctx.stroke(); ctx.beginPath(); ctx.moveTo(i, 40); ctx.lineTo(i, 600); ctx.closePath(); ctx.stroke(); }
Sorry, something went wrong.
No branches or pull requests
第585天 使用canvas画一个五子棋的棋盘
3+1官网
我也要出题
The text was updated successfully, but these errors were encountered: