Skip to content

Instantly share code, notes, and snippets.

@sirdarthvader
Created April 1, 2018 22:39
Show Gist options
  • Save sirdarthvader/0e8540f0be7b4869d7d620a36a46f2d4 to your computer and use it in GitHub Desktop.
Save sirdarthvader/0e8540f0be7b4869d7d620a36a46f2d4 to your computer and use it in GitHub Desktop.
let isDrawing = false;
function draw (e) {
if(!isDrawing) return ;
console.log(e);
}
canvas.addEventListener('mousemove', draw);
canvas.addEventListener('mousedown', () => isDrawing = true);
});
canvas.addEventListener('mouseup', ()=> isDrawing = false);
canvas.addEventListener('mouseout', () => isDrawing = false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment