一.直接上效果
二.html
canvas:
<canvas class="circle" id="circle" width="210" height="210"></canvas>
三.js
//获取画布元素
var circlecanvas1 = document.getElementById("circle");
//绘图方法function eachcanvas(dom,color1,percent){
var PI=Math.PI;
//绘制环形函数
var ctx= dom.getContext("2d");
ctx.beginPath();
ctx.strokeStyle=color;
ctx.lineWidth=12;
ctx.arc(105,105,93, ang1, ang2,bool);
ctx.stroke()