标题 | html5使用canvas画空心圆与实心圆 |
内容 | <canvas id="canvas" width="500" height="500"></canvas> 代码如下: var canvas=document.getElementById("canvas"); var cxt=canvas.getContext("2d"); //画一个空心圆 cxt.beginPath(); cxt.arc(200,200,50,0,360,false); cxt.lineWidth=5; cxt.strokeStyle="green"; cxt.stroke();//画空心圆 cxt.closePath(); //画一个实心圆 cxt.beginPath(); cxt.arc(200,100,50,0,360,false); cxt.fillStyle="red";//填充颜色,默认是黑色 cxt.fill();//画实心圆 cxt.closePath(); //空心和实心的组合 cxt.beginPath(); cxt.arc(300,300,50,0,360,false); cxt.fillStyle="red"; cxt.fill(); cxt.strokeStyle="green"; cxt.stroke(); cxt.closePath(); |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。