p5.js mousepressed code example
Example 1: if mousepressed javascript
var mouseDown = 0;
document.body.onmousedown = function() {
++mouseDown;
}
document.body.onmouseup = function() {
--mouseDown;
}
Example 2: p5 on mouse press
function mousePressed() {
ellipse(mouseX, mouseY, 5, 5);
// prevent default
return false;
}