# CanvasContext.setLineCap(string lineCap)
From base library 1.9.90 Start, this interface stops maintenance, please use CanvasContext.lineCap replace
with Promise style call: Not supported
Mini Program plugin: Support
Set the endpoint style of a line
# parameter
# string lineCap
End endpoint style of a line
lineCap Legal value
value | Introductions | Minimum version |
---|---|---|
butt | Adds a flat edge to each end of the line. | |
round | Add a round thread cap to each end of the line. | |
square | Add a square line cap to each end of the line. |
# sample code
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()