CanvasContext.lineTo

Add a new point, and line the last specified point to the new point. stroke() can be used to draw the line.

Parameters

It is Object type.

PropertyTypeDescription
xNumberThe x coordinate of destination point.
yNumberThe y coordinate of destination point.

Sample Code

copy
//.js
const ctx = my.createCanvasContext('awesomeCanvas')
ctx.moveTo(10, 10)
ctx.rect(10, 10, 100, 50)
ctx.lineTo(110, 60)
ctx.stroke()
ctx.draw()