Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/*
 D Nordlund
 PROG14998 Interactive Drawing - "Robin Red Boots"
 21 September 2016
 
 As the grub goes up, everything gets brighter.
 As the grub goes back into hiding, everything darkens.
 The bird moves its beak and tail as the user moves the grub around the screen.
 The hills, clouds, and sun/moon also move as the user moves the grub around the screen.
 Click for the bug to say something positive!
 Press any key for the bug to say something negative!
 */

void setup()
{
  size(400, 400);
  noCursor();
}

void draw()
{
  //Background gets darker as mouseY increases
  background(198, 244-mouseY/15, 255);

  //Sun/Moon, Clouds
  
  //Sun/Moon
  fill(255, 251, 235-mouseY/30);
  ellipse(60, 60-mouseY/100, 60, 60);
  //Clouds
  fill(255-mouseY/70);
  ellipse(50-mouseX/50, 180-mouseY/30, 70+mouseX/50, 70+mouseY/50);
  fill(255-mouseY/70);
  ellipse(100-mouseX/50, 160-mouseY/30, 100+mouseX/50, 100+mouseY/50);
  fill(255-mouseY/70);
  ellipse(210-mouseX/30, 90-mouseY/30, 75+mouseX/50, 75+mouseY/50);
  fill(255-mouseY/70);
  ellipse(260-mouseX/30, 79-mouseY/30, 100+mouseX/50, 100+mouseY/50);
  fill(255-mouseY/70);
  ellipse(300-mouseX/30, 100-mouseY/30, 50+mouseX/50, 50+mouseY/50);
  fill(255-mouseY/70);
  ellipse(310-mouseX/30, 50-mouseY/30, 60+mouseX/50, 60+mouseY/50);
  fill(255-mouseY/70);
  ellipse(345-mouseX/30, 85-mouseY/30, 80+mouseX/50, 80+mouseY/50);

  //Background Hills

  //furthest hill
  fill(162-mouseY/10, 208, 114);
  ellipse(360-mouseX/100, 370-mouseY/100, 480, 200);
  //middle hill
  fill(134, 201, 141-mouseY/30);
  ellipse(150-mouseX/100, 370-mouseY/100, 480, 200);
  //standing hill
  fill(173-mouseY/15, 211, 113);
  ellipse(200-mouseX/50-mouseY/50, 410, 530, 200);

  //Bird

  //legs
  stroke(0);
  strokeWeight(6);
  line(170, 240, 180, 300);
  line(215, 240, 225, 300);
  //boots
  noStroke();
  fill(241-mouseY/10, 92, 97);
  quad(170, 300, 167, 330, 185, 330, 190, 300);
  ellipse(165, 330, 40, 15);
  quad(215, 300, 212, 330, 230, 330, 235, 300);
  ellipse(210, 330, 40, 15);
  //body
  noStroke();
  fill(255, 231, 209-mouseY/30);
  ellipse(200, 210, 170, 150);
  fill(252, 151, 151-mouseY/10);
  ellipse(176, 220, 111, 120);
  //tail
  fill(255, 231, 209-mouseY/30);
  triangle(280, 200, 270, 250, 390, 200+mouseY/30);
  triangle(240, 250, 290, 220, 330, 290+mouseY/30);
  //wings
  fill(205, 183-mouseY/50, 158);
  //chunk1
  ellipse(190, 160, 50, 50);
  quad(163, 160, 200, 160, 210, 190, 184, 210);
  ellipse(201, 205, 35, 35);
  quad(185, 210, 199, 250, 225, 240, 218, 210);
  ellipse(213, 245, 30, 30);
  //rest of the wing
  ellipse(200, 160, 40, 50);
  ellipse(240, 200, 100, 100);
  ellipse(240, 243, 30, 30);
  ellipse(262, 235, 30, 30);
  ellipse(280, 220, 30, 30);
  ellipse(295, 200, 30, 30);
  triangle(200, 135, 260, 154, 230, 170);
  triangle(202, 135, 253, 152, 230, 170);
  triangle(265, 157, 290, 190, 307, 190);
  //head
  fill(205, 183-mouseY/50, 158);
  ellipse(125, 125, 100, 100);
  fill(255, 231, 209-mouseY/30);
  ellipse(117, 130, 85, 85);
  //bow
  stroke(238, 38, 52);
  fill(241-mouseY/10, 92, 97);
  triangle(120, 60, 110, 95, 150, 90);
  triangle(150, 90, 186, 115, 195, 80);
  ellipse(150, 90, 20, 20);
  //eye
  noStroke();
  fill(95, 48, 16);
  ellipse(135, 118, 25, 25);
  fill(0);
  ellipse(135, 118, 15, 15);
  fill(255);
  ellipse(138, 115, 3, 3);
  //bottom beak
  fill(95, 48, 16);
  triangle(32, 130+mouseY/30, 90, 140, 100, 130);
  //top beak
  fill(80, 48, 16); 
  triangle(30, 130-mouseY/50, 90, 110, 100, 130);

  //Grub  

  //body
  noStroke();
  fill(113, 73, 28);
  ellipse(mouseX, mouseY, 20, 40);
  //antennae
  ellipse(mouseX-5, mouseY-20, 2, 20);
  ellipse(mouseX+5, mouseY-20, 2, 20);
  //legs left
  ellipse(mouseX-5, mouseY-10, sin(frameCount*3)*20, 2);
  ellipse(mouseX-7, mouseY, sin(frameCount*3)*20, 2);
  ellipse(mouseX-5, mouseY+10, sin(frameCount*3)*20, 2);
  //legs right
  ellipse(mouseX+5, mouseY-10, sin(frameCount*3)*20, 2);
  ellipse(mouseX+7, mouseY, sin(frameCount*3)*20, 2);
  ellipse(mouseX+5, mouseY+10, sin(frameCount*3)*20, 2);
  //frontmost hill
  fill(134, 201, 141-mouseY/10);
  ellipse(200+mouseX/100, 450+mouseY/100, 570, 200);
}

void mousePressed()
{
  println("Grubbo: What a nice day!");
}

void keyPressed()
{
  println("Grubbo: to be eaten by a bird");
}