1、圆形,吃豆人
<style>canvas{width: 500px;height: 300px;border: 1px solid;}</style></head><body><canvas id="can" width="500px" height="300px"></canvas><script>// 圆:圆心(x,y),半径(r),弧度(起始弧度,结束弧度),方向(顺时针,逆时针)var canvas = document.getElementById('can');var ctx = canvas.getContext("2d");// ctx.arc(100,100,50,0,Math.PI * 2,0);//参数:圆心(x,y),半径(r),弧度(起始弧度,结束弧度),方向(顺时针,逆时针)// ctx.stroke();// 吃豆人ctx.arc(100,100,50,0,Math.PI * 1.9,0);ctx.lineTo(100,100);ctx.closePath();ctx.stroke();</script></body>
