xxxxxxxxxx
40
let brush = 1;
function setup() {
createCanvas(400, 400);
}
function draw() {
// Look ma, no code!
}
function mouseDragged() {
fill("#ffffff"); // default to white
translate(mouseX, mouseY); // zero our drawing to the mouse position
// Brush 1
if(brush == 1) {
fill(0, 0, 0);
circle(0, 0, 20);
}
// Brush 2
if(brush == 2) {
line(-10, -10, 10, 10);
}
// Brush 3
}
function keyPressed() {
if(key == 1) {
brush = 1;
}
if(key == 2) {
brush = 2;
}
// Step 2
}