setStrokeStyle在ios真机问题
发布于 6 年前 作者 guiying80 6669 次浏览 来自 问答

SetStrokeStyle如果设置的是gradient,setLineWidth在ios真机上无效

贴上代码

ctx.beginPath();
const grd = ctx.createLinearGradient(centerX, centerY + radius, centerX, centerY - radius);
grd.addColorStop(0, '#52ed78')
grd.addColorStop(0.5, '#dbe84c')
grd.addColorStop(0.95, '#ffa736')
grd.addColorStop(1, '#ffa736')
ctx.setLineWidth(5)
ctx.arc(centerX, centerY, radius, 0.5 * Math.PI, (progress-0.5)*2*Math.PI+0.5*Math.PI);
ctx.setStrokeStyle(grd)
ctx.stroke()

这是否是小程序bug?

回到顶部