Created
April 1, 2018 22:39
-
-
Save sirdarthvader/0e8540f0be7b4869d7d620a36a46f2d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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