[英]canvas after arc stroke line popping out
我正在與 Canvas 一起工作,當我像弧線一樣畫筆畫時,我看到筆畫線出現了:
渲染圓function:
function renderCircle(radius, angle, circleLength, circleAngle, circleColor, circleBorderColor, circleTextColor, circleFontStyle, value) {
var text = "$" + (typeof value === "number" ? value : this.data.value);
var coord = this.getCoordOnCircle(radius * 1.21, angle);
var circlePoint = {
x: this.gaugeCenterX - coord.x,
y: this.gaugeCenterY - coord.y
};
var ctx = this.ctx;
ctx.fillStyle = circleColor;
ctx.beginPath();
ctx.moveTo(circlePoint.x, circlePoint.y);
coord = this.getCoordOnCircle(circleLength * 1.18, angle - circleAngle);
ctx.arc((circlePoint.x + coord.x), (circlePoint.y + coord.y), circleLength, 0, 25 * Math.PI);
ctx.strokeStyle = circleBorderColor;
if(this.isAnimationEnabled) {
ctx.lineWidth = 2;
}
ctx.stroke();
ctx.closePath();
ctx.fill();
ctx.fillStyle = circleTextColor;
ctx.textAlign = 'center';
ctx.font = circleFontStyle;
ctx.fillText(text, (circlePoint.x + coord.x), (circlePoint.y + coord.y) + 5);
}
你可以看到這里的藍線稍微出來了。 有人知道為什么會這樣嗎?
解決了,我很愚蠢地添加了 ctx.moveTo(circlePoint.x, circlePoint.y);
我刪除了它並修復了
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.