xxxxxxxxxx
27
function setup() {
createCanvas(400, 300);
noStroke();
textSize(20);
}
function draw() {
background(220);
text(mouseY, 20, 20);
if (mouseY < 100) {
// red light
fill('red');
circle(200, 50, 100);
} else if (mouseY < 200) {
// yellow light
fill('yellow');
circle(200, 150, 100);
} else {
// green light
fill('green');
circle(200, 250, 100);
}
}