xxxxxxxxxx
39
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
fill (20, 20, 20);
noStroke();
rect (180, 350, 50, 50)
fill (50, 50, 50);
noStroke();
rect (130, 30, 150, 350)
noStroke ();
fill(0, 0, 0);
//red light
if (mouseY < 100) {
fill (255, 0, 0);
}
ellipse (200, 100, 90, 90);
//yellow light
if (mouseY < 200) {
fill (255, 255, 0);
}
ellipse (200, 200, 90, 90);
//green light
if (mouseY < 300) {
fill (0, 255, 0);
}
ellipse (200, 300, 90, 90);
}