Recitation 10—Tao Wen

The idea is when user clicks on each character in the picture, a picture featuring them is shown, like future-telling. If given enough time, I would make a flashing effect.

PImage image1,image2,image3;
float x=400;
float y=300;
float r=110;
int state=0;


void setup() {
  size(800, 600);
  image1 = loadImage("fox.jpg");
  image2=loadImage("dad1.jpg");
  image3=loadImage("dad2.jpg");
}
void draw() {
  background(0);
  imageMode(CENTER);
  image(image1, width/2, height/2);
  fill(235, 174, 52);
  ellipse(pmouseX,pmouseY,30,30);
  noStroke();
  fill(0, 0,0, 0);
  ellipse(x, y, r, r);
  if (mousePressed && ((mouseX-x)*(mouseX-x)+(mouseY-y)*(mouseY-y)<=r*r)) {
    state=1;
  }
  if (state==1){
  flash();
  }
  
    delay(30);
  }

  void flash(){
    imageMode(CENTER);
    image(image2,width/2,height/3,400,300);
  }
  
  

Leave a Reply