+ 1
How to draw a line on canvas?
4 Answers
+ 6
Hmm.
If you have got a 2d canvas context, you can start with:
ctx.beginPath();
this will begin a path.
Then, you move to a position:
ctx.moveTo(<xPos>, <yPos>);
Then, you make the line:
ctx.lineTo(<xPos>, <yPos>);
Then, you close the path:
ctx.closePath();
Then, you stroke the line:
ctx.stroke();
+ 4
see this lesson from everything.js :
https://www.sololearn.com/post/118502/?ref=app
0
Add your code
0
Thank you!