앞서나가는 사냥꾼님의 이글루입니다

kshpbo830.egloos.com

포토로그



2019_1 Interactive Video Week 6

















//-----coffee recipe-----
PImage background;
PImage cup;
PImage cream;

PFont font1;

//{espresso, chocolate syrup, steamed milk, milk form, water}
float[] Espresso={3, 0, 0, 0, 0}; 
float[] Macchiato={3, 0, 0, 5, 0};
float[] Cappuccino={3, 0, 7, 10, 0};
float[] Americano={2, 0, 0, 0, 10};
float[] Latte={3, 0, 8, 10, 0};
float[] Mocha={3, 5, 8, 0, 0};

boolean espresso = false;
boolean macchiato = false;
boolean cappuccino = false;
boolean americano = false;
boolean latte = false;
boolean mocha = false;

float espY=470;

float macchiY=470;
float macchi_foamY=470;

float cappuY=470;
float cappu_milkY=470;
float cappu_foamY=470;

float ameY=470;
float ame_waterY=470;

float latteY=470;
float latte_milkY=470;
float latte_foamY=470;

float mochaY=470;
float mocha_syrupY=470;
float mocha_milk=470;

float creamY=-50;

void setup() {
  size(904, 565); 
  background(228, 224, 222);
  background=(loadImage ("background.png"));
  cup=(loadImage ("cup.png"));
  cream=(loadImage("cream.png"));
  font1= loadFont("Sanchez-RegularItalic-48.vlw");
  textFont(font1);
  textSize(18);
}

void draw() {
  image(background, 0, 0);

  fill(250, 82, 65);
  noStroke();

  if (mouseX>670 && mouseX<870) { //make dot(button)
    if (mouseY>50 && mouseY<90) { //espresso
      circle(690, 69, 10);
    } else if (mouseY>123 && mouseY<203) { //macchiato
      circle(685, 160, 10);
    } else if (mouseY>239 && mouseY<279) { //Cappuccino
      circle(670, 258, 10);
    } else if (mouseY>311 && mouseY<351) { //americano
      circle(678, 332, 10);
    } else if (mouseY>387 && mouseY<427) { //Latte
      circle(715, 408, 10);
    } else if (mouseY>463 && mouseY<503) { //Mocha
      circle(705, 483, 10);
    }
  }

  //----show data-----

  if (espresso==true) {
    circle(690, 69, 10);

    fill(136, 92, 87);
    espY-=1.5;
    rect(50, espY, 500, 500);
    
    if (espY<200+27*(10-Espresso[0])) {
      espY=200+27*(10-Espresso[0]);
      fill(255);
      text("Espresso 3", 300, 407);
    }
  } else {
    espY=470;
  } 

  if (macchiato==true) {
    circle(685, 160, 10);

    fill(238, 236, 229); //milk foam
    macchi_foamY-=1.5;
    rect(50, macchi_foamY, 500, 500);
    if (macchi_foamY<200+27*(10-Macchiato[3])) {
      macchi_foamY=200+27*(10-Macchiato[3]);
      fill(136, 92, 87);
      text("Mlik Foam 2", 300, 353);
    }

    fill(136, 92, 87); //espresso
    macchiY-=1.5;
    rect(50, macchiY, 500, 500);
    if (macchiY<200+27*(10-Macchiato[0])) {
      macchiY=200+27*(10-Macchiato[0]);
      fill(255);
      text("Espresso 3", 300, 407);
    }
  } else {
    macchiY=470;
    macchi_foamY=470;
  }

  if (cappuccino==true) {
    circle(670, 258, 10);

    fill(238, 236, 229); //milk foam
    cappu_foamY-=1.5;
    rect(50, cappu_foamY, 500, 500);
    if (cappu_foamY<200+27*(10-Cappuccino[3])) {
      cappu_foamY=200+27*(10-Cappuccino[3]);
      fill(136, 92, 87);
      text("Mlik Foam 3", 300, 234);
    } 

    fill(211, 201, 182); //steamed milk
    cappu_milkY-=1.5;
    rect(50, cappu_milkY, 500, 500);
    if (cappu_milkY<200+27*(10-Cappuccino[2])) {
      cappu_milkY=200+27*(10-Cappuccino[2]);
      fill(105, 67, 39);
      text("Steamed Milk 4", 295, 299);
    }

    fill(136, 92, 87); //espresso
    cappuY-=1.5;
    rect(50, cappuY, 500, 500);
    if (cappuY<200+27*(10-Cappuccino[0])) {
      cappuY=200+27*(10-Cappuccino[0]);
      fill(255);
      text("Espresso 3", 300, 407);
    }
  } else {
    cappuY=470;
    cappu_milkY=470;
    cappu_foamY=470;
  }

  if (americano==true) {
    circle(678, 332, 10);

    fill(209, 224, 226); //water
    ame_waterY-=1.5;
    rect(50, ame_waterY, 500, 500);
    if (ame_waterY<200+27*(10-Americano[4])) {
      ame_waterY=200+27*(10-Americano[4]);
      fill(105, 67, 39);
      text("Water 8", 300, 234);
    }

    fill(136, 92, 87); //espresso
    ameY-=1.5;
    rect(50, ameY, 500, 500);
    if (ameY<200+27*(10-Americano[0])) {
      ameY=200+27*(10-Americano[0]);
      fill(255);
      text("Espresso 2", 300, 433);
    }
  } else {
    ameY=470;
    ame_waterY=470;
  }

  if (latte==true) {
    circle(715, 408, 10);

    fill(238, 236, 229); //milk foam
    latte_foamY-=1.5;
    rect(50, latte_foamY, 500, 500);
    if (latte_foamY<200+27*(10-Latte[3])) {
      latte_foamY=200+27*(10-Latte[3]);
      fill(136, 92, 87);
      text("Mlik Foam 2", 300, 234);
    } 

    fill(211, 201, 182); //steamed milk
    latte_milkY-=1.5;
    rect(50, latte_milkY, 500, 500);
    if (latte_milkY<200+27*(10-Latte[2])) {
      latte_milkY=200+27*(10-Latte[2]);
      fill(105, 67, 39);
      text("Steamed Milk 5", 300, 272);
    }

    fill(136, 92, 87); //espresso
    latteY-=1.5;
    rect(50, latteY, 500, 500);
    if (latteY<200+27*(10-Latte[0])) {
      latteY=200+27*(10-Latte[0]);
      fill(255);
      text("Espresso 3", 300, 407);
    }
  } else {
    latteY=470;
    latte_milkY=470;
    latte_foamY=470;
  }

  if (mocha==true) {
    circle(705, 483, 10);

    fill(211, 201, 182); //steamed milk
    mocha_milk-=1.5;
    rect(50, mocha_milk, 500, 500);
    if (mocha_milk<200+27*(10-Mocha[2])) {
      mocha_milk=200+27*(10-Mocha[2]); 
      fill(105, 67, 39);
      text("Steamed Milk 3", 300, 272);

      creamY+=2;
      image(cream, 115, creamY);
      if (creamY>130) {
        creamY=130;
        fill(105, 67, 39);
        text("Whipped Cream 2", 280, 234);
      }
    }  

    fill(160, 123, 99); //chocolate Syrup
    mocha_syrupY-=1.5;
    rect(50, mocha_syrupY, 500, 500);
    if (mocha_syrupY<200+27*(10-Mocha[1])) {
      mocha_syrupY=200+27*(10-Mocha[1]);
      fill(255);
      text("Chocolate Syrup 2", 250, 353);
    }

    fill(136, 92, 87); //espresso
    mochaY-=1.5;
    rect(50, mochaY, 500, 500);
    if (mochaY<200+27*(10-Mocha[0])) {
      mochaY=200+27*(10-Mocha[0]);
      fill(255);
      text("Espresso 3", 300, 407);
    }
  } else {
    mochaY=470;
    mocha_syrupY=470;
    mocha_milk=470;
    creamY=-50;
  }

  image(cup, 0, 0);

  noFill(); //draw marking
  stroke(255);
  strokeWeight(4);
  line(60, 200, 60, 470);

  line(60, 200, 80, 200);
  for (int i=1; i<10; i++) {
    line(60, 200+27*i, 70, 200+27*i);
  }
  line(60, 470, 80, 470);
}


void mousePressed() {
  if (mouseX>670 && mouseX<870) { //make dot(button)
    if (mouseY>50 && mouseY<90) { //espresso
      espresso = true;
      macchiato = false;
      cappuccino = false;
      americano = false;
      latte = false;
      mocha = false;
    } else if (mouseY>123 && mouseY<203) { //macchiato
      espresso = false;
      macchiato = true;
      cappuccino = false;
      americano = false;
      latte = false;
      mocha = false;
    } else if (mouseY>239 && mouseY<279) { //Cappuccino
      espresso = false;
      macchiato = false;
      cappuccino = true;
      americano = false;
      latte = false;
      mocha = false;
    } else if (mouseY>311 && mouseY<351) { //americano
      espresso = false;
      macchiato = false;
      cappuccino = false;
      americano = true;
      latte = false;
      mocha = false;
      ;
    } else if (mouseY>387 && mouseY<427) { //Latte
      espresso = false;
      macchiato = false;
      cappuccino = false;
      americano = false;
      latte = true;
      mocha = false;
    } else if (mouseY>463 && mouseY<503) { //Mocha
      espresso = false;
      macchiato = false;
      cappuccino = false;
      americano = false;
      latte = false;
      mocha = true;
    }
  }
}


덧글

댓글 입력 영역