Skip to content

Instantly share code, notes, and snippets.

@sirdarthvader
Created April 1, 2018 22:58
Show Gist options
  • Save sirdarthvader/638a98b899fe1e368b0bfbacd13c705a to your computer and use it in GitHub Desktop.
Save sirdarthvader/638a98b899fe1e368b0bfbacd13c705a to your computer and use it in GitHub Desktop.
let isDrawing = false;
let lastX = 0;
let lastY = 0;
function draw (e) {
if(!isDrawing) return ;
console.log(e);
ctx.beginPath();
ctx.moveTo(lastX, lastY);
ctx.lineTo(e.offsetX, e.offsetY);
ctx.stroke();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment