简体   繁体   English

更改球边框颜色

[英]Change Ball border color

So when drawing a ball in Canvas Html5 I notice there is a default border around it that is black with a thickness of about maybe 1? 因此,当在Canvas Html5中绘制一个球时,我注意到它周围有一个默认边框,该边框为黑色,厚度约为1? Do you know how to change the color? 你知道如何改变颜色吗? I already know how to change the color using CanvasContext.lineWidth. 我已经知道如何使用CanvasContext.lineWidth更改颜色。

要更改笔触的颜色,请将ctx.strokeStyle设置为CSS颜色名称。

您需要更改上下文的strokeStyle属性:

context.strokeStyle = '#ffffff'; // Gives a white border

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

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