Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
因此,当在 Canvas Html5 中绘制一个球时,我注意到它周围有一个默认边框,它是黑色的,厚度大约为 1?你知道如何改变颜色吗?我已经知道如何使用 CanvasContext.lineWidth 更改颜色。
您需要更改上下文的 strokeStyle 属性:
context.strokeStyle = '#ffffff'; // Gives a white border
要更改描边的颜色,请设置ctx.strokeStyle为 CSS 颜色名称。
ctx.strokeStyle