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

绘图接口和方法

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()

绘图接口和方法

版权声明:本文由lzhuji.com主机评测所有
文章名称:《微信小程序API 绘图setLineCap(设置线条端点样式)》
文章链接:https://www.lzhuji.com/271627.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

本站不对信息的真伪做任何的保障,请自行甄别,自负责任。

登录

找回密码

注册