xxxxxxxxxx
42
let bacteriaX = 0
let bacteriaY = 0
function setup() {
createCanvas(750, 750);
let r = random(255);
let g = random(255);
let b = random(255);
background(r, g, b);
}
function draw() {
//Disinfectants
fill(255, 255, 51)
square(mouseX, mouseY, 50);
//Branches
fill(100, 0, 0);
rect(180, 570, 50, 200);
rect(505, 570, 50, 200);
//Leaves
fill(0, 255, 0)
triangle(130, 575, 208, 460, 286, 575)
triangle(450, 575, 528, 460, 606, 575)
//Bacteria
bacteriaX = random(width)
bacteriaY = random(height)
fill(255, 51, 51)
ellipse(bacteriaX, bacteriaY, 30, 30);
}
function mousePressed() {
let r = random(255);
let g = random(255);
let b = random(255);
background(r, g, b);
}