CanvasContext.setLineDash
Set the style of dash line.
Parameters
It is Object type.
Property | Type | Description |
segments | Array | A set of Numbers describing the length of alternately drawn line segments and spacing (units of coordinate space). If the number of array elements is odd, the array elements are copied and repeated. For example, the [5, 15, 25] will be changed to [5, 15, 25, 5, 15, 25]. |
Sample Code
copy
// .js
const ctx = my.createCanvasContext('awesomeCanvas')
ctx.setLineDash([10, 20])
ctx.beginPath()
ctx.moveTo(0,100)
ctx.lineTo(400, 100)
ctx.stroke()
ctx.draw()