简体   繁体   English

在HTML5画布上不完美的球绘图

[英]Imperfect Ball drawing on HTML5 Canvas


HTML5 Canvas seems to be drawing imperfect balls on certain conditions. HTML5 Canvas似乎在某些条件下绘制不完美的球。 When there's a red background, and a blue circle with a black outline, it seems the outline is wider in the left side and thinner in the right. 当有一个红色背景和一个黑色轮廓的黑色圆圈时,左侧的轮廓似乎更宽,右侧的轮廓更薄。 Here's a fiddle illustrating this: https://jsfiddle.net/omgszg38/4/ . 这是一个说明这一点的小提琴: https//jsfiddle.net/omgszg38/4/ Don't it seems to you too? 你似乎也不是吗?
Here is the code that is drawing the ball: 以下是绘制球的代码:

d.beginPath();
d.fillStyle = "blue";
d.arc(x,y,radius,0,Math.PI*2,false);
d.fill();

d.lineWidth = 1; //Ball stroke

d.beginPath();
d.arc(x,y,radius,0,Math.PI*2,false);
d.stroke();

Note: I have already asked for help about this in another forum and here is it, if you need more info: http://www.webdeveloper.com/forum/showthread.php?359393-Imperfect-Ball-drawing-on-HTML5-Canvas 注意:我已经在另一个论坛上寻求过这方面的帮助,如果您需要更多信息,请点击此处: http//www.webdeveloper.com/forum/showthread.php? 359393-Imperfect-Ball-drawing- on- HTML5的画布

It may be an optical illusion. 这可能是一种视错觉。 if you set the stroke to white it appears fine. 如果将笔划设置为白色,则显示正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM