Code

void setup () {
  size (400, 400);
  background (60);
}

void loop() {
  if (mouseX >= 150
  && mouseX <= 250
  && mouseY >= 150
  && mouseY <= 250
  && mousePressed == true)
  {
    fill (0);
  }
  else
  
if (mouseX >= 150
  && mouseX <= 250
  && mouseY >= 150
  && mouseY <= 250
  && mousePressed == false)
  {
    fill (255, 201, 1);
  } else
  {
    fill(255);
  }
  rect(150, 150, 100, 100);

}

005 -- Conditional Testing in Interactivity: A Classic Button

Statement:Modify your square from Assignment #004, such that it becomes a button with a "hover" state: White when inactive; Yellow when the user is hovering over it (mouseDown is false); Black when the user is holding the mouse down inside of it; and which returns to white thereafter.


more buttercup than yellow, like eddie bauer's "dalia"

hide statement