CanvasContext.setLineWidth
解释:设置线条的宽度。
方法参数
Number lineWidth
lineWidth
参数说明 :线条的宽度(单位是 px)
示例
扫码体验
请使用百度APP扫码
图片示例
代码示例
const canvasContext = swan.createCanvasContext('myCanvas');
canvasContext.beginPath();
canvasContext.moveTo(30, 10);
canvasContext.lineTo(200, 10);
canvasContext.stroke();
canvasContext.beginPath();
canvasContext.setLineWidth(5);
canvasContext.moveTo(50, 30);
canvasContext.lineTo(200, 30);
canvasContext.stroke();
canvasContext.beginPath();
canvasContext.setLineWidth(10);
canvasContext.moveTo(70, 50);
canvasContext.lineTo(200, 50);
canvasContext.stroke();
canvasContext.beginPath();
canvasContext.setLineWidth(15);
canvasContext.moveTo(90, 70);
canvasContext.lineTo(200, 70);
canvasContext.stroke();
canvasContext.draw();