How to draw a line in Canvas?

In order to draw a line in Canvas, we have to use  moveTo(x,y) and  lineTo(x,y)  methods from  getContext('2d') . The moveTo(x,y) denotes the starting point for drawing the line and lineTo denotes the ending point for the line. We draw the line by using  stroke() method.



Leave a Reply