Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
//SEAN GRAFTON
//ID: 991429843
//INTRO MEDIA COMP.
//SECTION P04

void setup() {
  //set up a 400x400 sketch
	size(400,400);
  
}

void draw(){
  //blue sky and green ground background to refresh images
  background(100,100,255);
  fill(100,255,100);
  rect(0,380,400,20);
  //draw the legs in pink with a line in a dark pink
  strokeWeight(4);
  stroke(255,100,100);
  fill(255,150,150);
  //left screen leg
  quad(mouseX-30,mouseY+40,mouseX-40,mouseY+60,mouseX-20,mouseY+60,mouseX-10,mouseY+40);
  //right screen leg
  quad(mouseX+30,mouseY+40,mouseX+40,mouseY+60,mouseX+20,mouseY+60,mouseX+10,mouseY+40);
  //draw the ears in the same pink
  //left screen ear
  triangle(mouseX-40,mouseY-30,mouseX-40,mouseY-60,mouseX-10,mouseY-40);
  //right screen ear
  triangle(mouseX+40,mouseY-30,mouseX+40,mouseY-60,mouseX+10,mouseY-40);
  //draw the tail in the dark pink line with arcs (largest to smallest curl)
  noFill();
  arc(mouseX+50, mouseY+20, 40, 40, 0, PI);
  arc(mouseX+55, mouseY+20, 30, 30, PI, PI+PI);
  arc(mouseX+50, mouseY+20, 20, 20, 0, PI);
  //draw the body in pink
  fill(255,150,150);
  ellipse(mouseX,mouseY,100,100);
  //draw the nose, with contrast in shade on pink, return to normale stroke weight
  strokeWeight(1);
  fill(255,200,200);
  ellipse(mouseX,mouseY+10,60,40);
  //draw the nostrils and eyes in black
  fill(0,0,0);
  //nostrils
  ellipse(mouseX-10,mouseY+10,15,20);
  ellipse(mouseX+10,mouseY+10,15,20);
  //eyes
  ellipse(mouseX-20,mouseY-20,15,15);
  ellipse(mouseX+20,mouseY-20,15,15);
  //draw the pig pen, making it brown, back to black lines
  fill(139,69,19);
  stroke(0);
  rect(140,380,130,10);
  rect(150,370,10,30);
  rect(170,370,10,30);
  rect(190,370,10,30);
  rect(210,370,10,30);
  rect(230,370,10,30);
  rect(250,370,10,30);
}

void mousePressed() {
  //make em oink!
  println("OINK!");
}