设置线条的交点样式。
参数 | 类型 | 范围 | 说明 |
---|---|---|---|
linejoin | string | 'bevel'、'round'、'miter' | 线条的结束交点样式 |
const ctx = wx.createcanvascontext('mycanvas')
ctx.beginpath()
ctx.moveto(10, 10)
ctx.lineto(100, 50)
ctx.lineto(10, 90)
ctx.stroke()
ctx.beginpath()
ctx.setlinejoin('bevel')
ctx.setlinewidth(10)
ctx.moveto(50, 10)
ctx.lineto(140, 50)
ctx.lineto(50, 90)
ctx.stroke()
ctx.beginpath()
ctx.setlinejoin('round')
ctx.setlinewidth(10)
ctx.moveto(90, 10)
ctx.lineto(180, 50)
ctx.lineto(90, 90)
ctx.stroke()
ctx.beginpath()
ctx.setlinejoin('miter')
ctx.setlinewidth(10)
ctx.moveto(130, 10)
ctx.lineto(220, 50)
ctx.lineto(130, 90)
ctx.stroke()
ctx.draw()