微信小程序API绘图setLineCap,微信小程序设置线条端点样式

发布时间:2023-07-19 22:57:15 作者:dasemo 阅读量:8261

 

canvasContext.setLineCap


定义

设置线条的端点样式。

参数

参数 类型 范围 说明
lineCap String 'butt'、'round'、'square' 线条的结束端点样式

示例代码:

const ctx = wx.createCanvasContext('myCanvas')
ctx.beginPath()
ctx.moveTo(10, 10)
ctx.lineTo(150, 10)
ctx.stroke()

ctx.beginPath()
ctx.setLineCap('butt')
ctx.setLineWidth(10)
ctx.moveTo(10, 30)
ctx.lineTo(150, 30)
ctx.stroke()

ctx.beginPath()
ctx.setLineCap('round')
ctx.setLineWidth(10)
ctx.moveTo(10, 50)
ctx.lineTo(150, 50)
ctx.stroke()

ctx.beginPath()
ctx.setLineCap('square')
ctx.setLineWidth(10)
ctx.moveTo(10, 70)
ctx.lineTo(150, 70)
ctx.stroke()

ctx.draw()

 

更多微信小程序开发教程,可以关注多程序。
***本网站图片,文字之类版权申明,因为网站可以由注册用户自行上传图片或文字,本网站无法鉴别所上传图片或文字的知识版权,如果侵犯,请及时通知我们,本网站将在第一时间及时删除。

我要评论

秒制作
Catfish(鲶鱼) Blog V 4.7.3