Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/*

"Poke the Cat"

Made by Kilian Johnson

This is an interactive drawing where the player is able to poke this innocent cat to wake it up (if they choose to). Don't worry it should go back to sleep quickly.
 */

void setup() {
  //Setting size of window to 400 by 400
  size(400, 400);
}

void draw() {
  //Resetting frame rate after mouse is pressed
  frameRate(60);
  //Setting background (Wall) color
  background(55, 23, 123);

  //Setting floor color
  fill(55, 103, 140);
  rect(0, 150, 400, 400);

  //Door in background
  fill(182, 120, 90);
  rect(40, 60, 60, 90);
  fill(214, 189, 169);
  ellipse(85, 105, 7, 7);

  //Cat Tail
  noFill();
  stroke(0, 0, 50);
  strokeWeight(10);
  bezier(350, 190, 400, 190, 360, 300, 390, 280);

  // Cat Body
  strokeWeight(1);
  fill(0, 0, 50);
  stroke(150);
  ellipse(230, 200, 240, 150+20*sin(frameCount*.05));

  //Cat Ears
  triangle(40, 140, 30, 190, 50, 170);
  triangle(120, 140, 110, 170, 125, 180);

  //Cat Head
  ellipse(80, 200, 110, 90);

  //Cat Paws
  ellipse(65, 250, 30, 30);
  ellipse(95, 250, 30, 30);

  //Cat Eyes
  noFill();
  strokeWeight(1);
  arc(50, 185, 20, 10, 0, PI);
  arc(90, 185, 20, 10, 0, PI);

  //Cat Nose
  triangle(75, 200, 65, 210, 85, 210);

  //Cat Mouth
  arc(75, 220, 30, 10, 0, PI);

  //Cat Whiskers
  line(50, 205, 60, 210);
  line(48, 210, 58, 213);
  line(46, 215, 56, 216);
  line(95, 210, 105, 205);
  line(97, 213, 107, 210);
  line(97, 216, 107, 215);

  //Snot Bubble
  fill(90, 90, 90);
  ellipse(70, 210, 25, 20+5*sin(frameCount*.05));
  fill(200);
  ellipse(65, 208, 5, 6+3*sin(frameCount*.05));

  //Window with night sky
  fill(182, 120, 90);
  rect(290, 10, 100, 100);
  stroke(111, 31, 31);
  line(290, 10, 300, 20);
  line(390, 10, 380, 20);
  line(290, 110, 300, 100);
  line(390, 110, 380, 100);
  fill(0);
  rect(300, 20, 80, 80);
  fill(255);
  ellipse(360, 40, 20, 20);
  ellipse(330, 50, 5, 5);
  ellipse(360, 80, 5, 5);
  ellipse(320, 60, 5, 5);
  ellipse(310, 90, 5, 5);
  ellipse(340, 80, 5, 5);
  ellipse(330, 50, 5, 5);
  ellipse(310, 30, 5, 5);

  //Poking Pencil
  fill(255, 191, 23);
  quad(mouseX-45, mouseY+45, mouseX+50, mouseY-50, mouseX+45, mouseY-55, mouseX-50, mouseY+40);
  fill(255, 190, 190);
  quad(mouseX+50, mouseY-50, mouseX+45, mouseY-55, mouseX+50, mouseY-60, mouseX+55, mouseY-55);
  fill(0);
  triangle(mouseX-45, mouseY+45, mouseX-50, mouseY+40, mouseX-55, mouseY+50);
}

void mousePressed() {
  //Slowing frame rate after mouse is pressed to let image persist longer
  frameRate(1);

  //Setting background (Wall) color
  background(55, 23, 123);

  //Setting floor color
  fill(55, 103, 140);
  rect(0, 150, 400, 400);

  //Door in background
  fill(182, 120, 90);
  rect(40, 60, 60, 90);
  fill(214, 189, 169);
  ellipse(85, 105, 7, 7);

  //Cat Tail
  noFill();
  stroke(0, 0, 50);
  strokeWeight(10);
  bezier(350, 190, 400, 190, 360, 300, 390, 280);

  // Cat Body
  strokeWeight(1);
  fill(0, 0, 50);
  stroke(150);
  ellipse(230, 200, 240, 150+20*sin(frameCount*.05));

  //Cat Ears
  triangle(40, 140, 30, 190, 50, 170);
  triangle(120, 140, 110, 170, 125, 180);

  //Cat Head
  ellipse(80, 200, 110, 90);

  //Cat Paws
  ellipse(65, 250, 30, 30);
  ellipse(95, 250, 30, 30);

  //Cat Nose
  triangle(75, 200, 65, 210, 85, 210);

  //Cat Mouth
  fill(255);
  arc(75, 220, 30, 10, 0, PI);

  //Cat Eyes (Open)
  fill(255);
  ellipse(50, 185, 30, 30);
  ellipse(90, 185, 30, 30);
  fill(250, 201, 40);
  ellipse(50, 185, 10, 10);
  ellipse(90, 185, 10, 10);

  //Cat Whiskers
  line(50, 205, 60, 210);
  line(48, 210, 58, 213);
  line(46, 215, 56, 216);
  line(95, 210, 105, 205);
  line(97, 213, 107, 210);
  line(97, 216, 107, 215);

  //Snot Bubble (Popped)
  strokeWeight(2);
  line(70, 200, 70, 190);
  line(75, 202, 78, 193);
  line(76, 206, 82, 200);
  line(78, 210, 86, 210);
  line(76, 214, 82, 220);
  line(75, 218, 78, 224);
  line(70, 220, 70, 230);
  line(65, 218, 62, 224);
  line(64, 214, 58, 220);
  line(60, 210, 50, 210);
  line(64, 206, 58, 200);
  line(65, 202, 62, 196);

  //Cat meowing after being woken up
  println("Meow!");

  //Window with night sky
  strokeWeight(1);
  fill(182, 120, 90);
  rect(290, 10, 100, 100);
  stroke(111, 31, 31);
  line(290, 10, 300, 20);
  line(390, 10, 380, 20);
  line(290, 110, 300, 100);
  line(390, 110, 380, 100);
  fill(0);
  rect(300, 20, 80, 80);
  fill(255);
  ellipse(360, 40, 20, 20);
  ellipse(330, 50, 5, 5);
  ellipse(360, 80, 5, 5);
  ellipse(320, 60, 5, 5);
  ellipse(310, 90, 5, 5);
  ellipse(340, 80, 5, 5);
  ellipse(330, 50, 5, 5);
  ellipse(310, 30, 5, 5);

  //Poking Pencil
  fill(255, 191, 23);
  quad(mouseX-45, mouseY+45, mouseX+50, mouseY-50, mouseX+45, mouseY-55, mouseX-50, mouseY+40);
  fill(255, 190, 190);
  quad(mouseX+50, mouseY-50, mouseX+45, mouseY-55, mouseX+50, mouseY-60, mouseX+55, mouseY-55);
  fill(0);
  triangle(mouseX-45, mouseY+45, mouseX-50, mouseY+40, mouseX-55, mouseY+50);
  //line(mouseX-45,mouseY+45,mouseX+50,mouseY-50);
  //line(mouseX-50,mouseY+40,mouseX+45,mouseY-55);
}