0
How do i use the built in line function
I know that the beginning of drawing the line after the canvas is set up should look like this ctx is my canvas context ctx.moveTo(0,0); ctx.lineTo(20,20); I know this should draw a line from point 0,0 to 20,20 but it didnt work for me i think it just sets up the line but doesnt draw it. Please tell me if im missing something.
1 ответ
0
Is this all your code? Try to make a diagonal line like:
var c = document.getElementById("canvasLine");
var ctx = c.getContext("2d");
ctx.moveTo(0,0);
ctx.lineTo(20,10);
ctx.stroke();