我正在寻找围绕多个圆圈画一条线,但只是圆形的百分比。具体来说,我需要动态输入特定的百分比来绘制这些圆圈,所以我目前的开始和结束角度的方法会导致问题:
var data = [
{id:'firefox', angle:90-90},
{id:'chrome', angle:144},
{id:'ie', angle:72},
{id:'opera', angle:28.8},
{id:'safari', angle:7.2}
];
data.forEach(function(e){
var canvas = document.getElementById(e.id);
var context = canvas.getContext('2d');
context.beginPath();
context.arc(64, 64, 60, 1.5*Math.PI, e.angle, true);
context.lineWidth = 8;
context.lineCap = "round";
context.strokeStyle = '#c5731e';
context.stroke();
});