We read about html5 canvas in last post, we can do lot with canvas. As today, i am going to learn how to draw lines using html5 canvas. HTML5 canvas having a lot of things to learn so we learn various small-2 things regularly.
To draw lines, canvas used 4 methods beginPath(), moveTo(), lineTo(), and stroke() methods. Lets know more about them in detail –
beginPath() – this methods reset the current path or declare a new path.
moveTo(x,y) – it creates a new sub-path with the given point.
lineTo() – it adds the given point to current subpath.
stroke() – it draws the line actually, gives the visibility to line.