Answer the question
In order to leave comments, you need to log in
HTML5 Canvas - LineTo?
It is necessary for me, that in Canvas' the line from a point 50, 50
to the cursor was drawn. Here is the JS code:
$(canv).mousemove(evt => {
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, canv.width, canv.height);
ctx.strokeStyle = '#000';
ctx.beginPath();
ctx.moveTo(50, 50);
ctx.lineTo(evt.clientX, evt.clientY);
ctx.stroke();
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question