CanvasContext.setMiterLimit

Set the maximum miter length, which is the distance between the inner and outer angles at the intersection of the two lines. Only valid when setLineJoin() is miter. Where the maximum length is exceeded, the join is displayed as lineJoin as bevel.

Parameters

It is Object type.

PropertyTypeDescription
miterLimitNumberThe maximum miter length.

Sample Code

copy
//.js
const ctx = my.createCanvasContext('awesomeCanvas')
ctx.beginPath()
ctx.setLineWidth(15)
ctx.setLineJoin('miter')
ctx.setMiterLimit(1)
ctx.moveTo(10, 10)
ctx.lineTo(100, 50)
ctx.lineTo(10, 90)
ctx.stroke()

ctx.beginPath()
ctx.setLineWidth(15)
ctx.setLineJoin('miter')
ctx.setMiterLimit(2)
ctx.moveTo(50, 10)
ctx.lineTo(140, 50)
ctx.lineTo(50, 90)
ctx.stroke()

ctx.beginPath()
ctx.setLineWidth(15)
ctx.setLineJoin('miter')
ctx.setMiterLimit(3)
ctx.moveTo(90, 10)
ctx.lineTo(180, 50)
ctx.lineTo(90, 90)
ctx.stroke()

ctx.draw()