Week 6 Interactive Video 2019



Alice Bar

alcohol proof (%)

Click the bottle of the alcohol which you want to check the alcohol proof of it.
Should click until the number shows up!



Code


int[] alcohol = new int[7];
float ypos1 = 540;
float ypos2 = 540;
float ypos3 = 540;
float ypos4 = 540;
float ypos5 = 540;
float ypos6 = 540;
float ypos7 = 540;
PFont harlow;
PFont aller;

void setup()
{
  size(960, 540);
  background(234, 215, 175);
 
  //Jager Meister
  alcohol[0] = 35;
  //Alize
  alcohol[1] = 20;
  //X rated
  alcohol[2] = 17;
  //Fireball
  alcohol[3] = 33;
  //Bacardi Mojito
  alcohol[4] = 18;
  //Absolut
  alcohol[5] = 40;
  //Bombay
  alcohol[6] = 47;
 
  harlow=loadFont("HarlowSolid-150.vlw");
  aller=loadFont("Aller-20.vlw");

}

void draw()
{
  //background(162, 207, 240);
 
  //graph
  for(int i=0; i<alcohol.length; i++) {
    noStroke();
    fill(100, (alcohol[i]-7)*5+20, alcohol[i]+150);
    rect(45+i*130, 540, 90, -(alcohol[i]-5)*10);
  }
 
  //numbers
  for(int i=0; i<7; i++) {
    textSize(20);
    fill(255);
    textFont(aller);
    text(alcohol[i], 75+i*130, 530-(alcohol[i]-5)*10);
  }
 
  fill(234, 215, 175);
  rect(20, 120, 135, ypos1);
  rect(155, 120, 130, ypos2);
  rect(285, 120, 130, ypos3);
  rect(415, 200, 130, ypos4);
  rect(545, 120, 130, ypos5);
  rect(675, 120, 130, ypos6);
  rect(805, 50, 130, ypos7);

  if (mouseX>20 && mouseX<155) {
    if (mousePressed == true) {
      ypos1=ypos1-20;
    }
  }
  if (mouseX>155 && mouseX<285) {
    if (mousePressed == true) {
      ypos2=ypos2-20;
    }
  }
  if (mouseX>285 && mouseX<415) {
    if (mousePressed == true) {
      ypos3=ypos3-10;
    }
  }
  if (mouseX>415 && mouseX<545) {
    if (mousePressed == true) {
      ypos4=ypos4-10;
    }
  }
  if (mouseX>545 && mouseX<675) {
    if (mousePressed == true) {
      ypos5=ypos5-10;
    }
  }
  if (mouseX>675 && mouseX<805) {
    if (mousePressed == true) {
      ypos6=ypos6-10;
    }
  }
  if (mouseX>805 && mouseX<935) {
    if (mousePressed == true) {
      ypos7=ypos7-10;
    }
  }
 
  //Jager Meister
  fill(1, 80, 8);
  rect(40, 480, 100, 60);
  ellipse(90, 480, 100, 40);
  rect(75, 440, 30, 40);
  fill(255);
  rect(50, 490, 80, 50);
  ellipse(90, 490, 80, 30);
  strokeWeight(10);
  stroke(60, 183, 70);
  rect(60, 500, 60, 60);
  noStroke();
  fill(232, 70, 40);
  rect(53, 525, 74, 20);
 
  //Alize
  fill(222, 222, 222);
  rect(190, 450, 15, 25);
  rect(235, 450, 15, 25);
  fill(252, 143, 176);
  quad(170, 500, 175, 540, 220, 540, 225, 500);
  ellipse(197.5, 500, 55, 60);
  fill(144, 224, 255);
  translate(45, 0);
  quad(170, 500, 175, 540, 220, 540, 225, 500);
  ellipse(197.5, 500, 55, 60);
 
  translate(-45, 0);
 
  //X rated
  fill(222, 222, 222);
  rect(340, 450, 20, 30);
  fill(255, 121, 157);
  rect(305, 480, 90, 60);
  quad(295, 470, 310, 540, 390, 540, 405, 470);
  stroke(255);
  strokeWeight(5);
  line(315, 500, 335, 500);
  line(385, 500, 365, 500);
  line(325, 500, 365, 540);
  line(375, 500, 335, 540);
 
  //Fireball
  noStroke();
  fill(255, 141, 0);
  rect(430, 480, 100, 60);
  triangle(430, 480, 530, 480, 480, 460);
  rect(465, 450, 30, 30);
  fill(220, 70, 70);
  rect(462, 430, 36, 20);
  fill(255, 213, 0);
  rect(440, 500, 80, 40);
 
  //Bacardi Mojito
  fill(222, 222, 222);
  rect(600, 440, 20, 40);
  fill(218, 245, 178);
  quad(560, 500, 565, 540, 655, 540, 660, 500);
  ellipse(610, 500, 100, 80);
  fill(255);
  quad(570, 510, 575, 540, 645, 540, 650, 510);
  circle(610, 510, 40);
  fill(220, 70, 70);
  circle(610, 510, 25);
 
  //Absolut
  fill(230, 230, 230);
  rect(690, 500, 100, 40);
  ellipse(740, 500, 100, 80);
  rect(725, 440, 30, 40);
  fill(180, 180, 180);
  rect(722, 425, 36, 15);
  fill(0, 15, 160);
  rect(700, 505, 80, 25);
 
  //Bombay
  fill(100, 212, 255);
  rect(820, 490, 100, 50);
  triangle(820, 490, 920, 490, 870, 450);
  rect(855, 430, 30, 40);
  fill(30, 30, 30);
  rect(855, 420, 30, 25);
  fill(255);
  rect(830, 510, 80, 40);
  ellipse(870, 510, 80, 30);
  strokeWeight(5);
  stroke(180, 133, 0);
  rect(840, 520, 60, 30);
 
  noStroke();
  fill(234, 215, 175);
  rect(280, 50, 400, 120);
 
  fill(167, 137, 88);
  textFont(harlow);
  textSize(60);
  text("Alice Bar", 340, 100);
  fill(106, 94, 71);
  textFont(aller);
  textSize(15);
  text("alcohol proof (%)", 420, 150);
 
}

덧글

댓글 입력 영역