【发布时间】:2012-01-22 21:33:25
【问题描述】:
我想解决这个问题很简单,如果这很明显,请提前道歉,但我似乎无法弄清楚如何为两个不同的弧线设置两个不同的填充样式......我只是想能够绘制不同颜色的圆圈。下面我介绍了我通常如何使用画布中的其他形状/绘图方法进行操作,但由于某种原因,对于弧线,它会将两条弧线都设置为最后一个填充样式。
ctx.fillStyle = "#c82124"; //red
ctx.arc(15,15,15,0,Math.PI*2,true);
ctx.fill();
ctx.fillStyle = "#3370d4"; //blue
ctx.arc(580,15,15,0,Math.PI*2,true);
ctx.fill();
【问题讨论】:
标签: javascript canvas colors fill geometric-arc