javascript - 弧线笔划线弹出后的画布
问题描述
我正在使用 Canvas,当我像围绕弧线一样绘制笔触时,我看到笔触线出现:
渲染圆圈功能:
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);
我删除了它并修复了
推荐阅读
- java - 从 ResultSet 中获取以 NanoSeconds 为单位的时间戳
- sql - 计算年初至今重复
- php - sim800l 和 api rest 的 cookie 问题
- php - 如何在 Symfony 4 中使用 cronjob 检查我的数据库,以便在必要时更改它?
- javascript - nodejs 和浏览器之间的一些 Javascript 功能如何实现不同?
- php - 在一个 Postgresql 中更新多个表
- plot - 函数图,DomainError。产生复杂结果的求幂需要一个复杂的参数
- ubuntu - 默认目录在 OpenSSL 配置文件中不起作用
- vba - 如何在当前打开的数据库上通过 excel VBA 运行访问宏?
- python - 将颜色图图例添加到 Folium 地图