xxxxxxxxxx
25
var brush = 10;
function setup() {
createCanvas(400, 400);
noStroke();
background(0);
console.log("use: \nmouseWheel for brush size\nmouse button pressed: \nLEFT paint white\nRIGHT erase\nWHEEL for clear");
}
function draw() {
if (mouseButton === RIGHT) fill(0);
if (mouseButton === LEFT) fill(255);
if (mouseButton === CENTER) background(0);
if (mouseIsPressed) ellipse(mouseX, mouseY, brush, brush);
}
function mouseWheel(event) {
brush += event.delta;
brush = constrain(brush, 1, width / 2);
print("brush: " + brush);
}
document.oncontextmenu = function() {
return false;
}