Week5 Interactive Video 2019


Alice Bar

Welcome to the Alice Bar!!! We are selling a Magic Cocktail, which its color changes!
You can move your Magic Cocktail anywhere you want and change the color of the cocktail by pressing your mouse.
Now enjoy your DRINK!



float cup1 = 30;
int c = 255;
PFont harlow;

void setup()
{
  size(960, 540);
  background(213, 166, 216);
 
  harlow=loadFont("HarlowSolid-100.vlw");
}

void draw()
{
  background(213, 166, 216);
 
  //table
  noStroke();
  fill(173, 130, 101);
  rect(0, 420, 960, 120);
  fill(198, 165, 142);
  rect(0, 360, 960, 70);
 
  //light
  fill(255, 232, 116);
  circle(232.5, 100, 40);
  fill(227, 227, 227);
  rect(225, 0, 15, 100);
  triangle(232.5, 45, 180, 100, 285, 100);
 
  //cup
  translate(500, 0);
  fill(255, 232, 116);
  circle(232.5, 100, 40);
  fill(227, 227, 227);
  rect(225, 0, 15, 100);
  triangle(232.5, 45, 180, 100, 285, 100);
 
  translate(-500, 0);
  fill(219, 247, 255);
  triangle(cup1, 180, cup1+120, 300, cup1+240, 180);
  rect(cup1+113, 270, 14, 120);
  ellipse(cup1+120, 390, 120, 30);
 
  if (mousePressed == true) {
    println(frameCount);
  }
 
  //magic cocktail
  fill (c);
  triangle(cup1+50, 210, cup1+120, 280, cup1+190, 210);
 
  textFont(harlow);
  textSize(60);
  text("Alice Bar", 340, 120);
 
}

void keyPressed() {
  if (key == CODED) {
    if (keyCode == RIGHT) {
      if (cup1+240<930) {
        cup1 = cup1+2;
      }
    } else if (keyCode == LEFT) {
      if (cup1>30) {
        cup1 = cup1-2;
      }
    }
  }
}

void mousePressed()
{
  c=color(random(255), random(255), random(255));
  println("mousePressed()");
}

덧글

댓글 입력 영역