50, 50
до курсора. Вот JS код:$(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();
});
Properties such as .clientX, .offsetX, and .pageX are available, but support for them differs between browsers. Fortunately, jQuery normalizes the .pageX and .pageY properties so that they can be used in all browsers.