Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
void setup() {
  size(400, 400);
  rectMode(CORNERS);
  ellipseMode(CORNERS);
  smooth();
}

void draw() {

  frameRate(60);

  background(#DED46B);

  fill(#A27B48); //ground
  rect(0, 210, 400, 400);

  strokeWeight(1); //head
  stroke(#3F522F);
  fill(#83B954);
  rect(160, 80, 310, 180);
  fill(#567C36);
  quad(160, 80, 140, 100, 140, 160, 160, 180);
  line(140, 140, 160, 160);
  line(160, 160, 230, 160);
  fill(0);
  noStroke();
  ellipse(260, 100, 290, 130);

  strokeWeight(1); //body
  fill(#83B954);
  stroke(#3F522F);
  rect(220, 180, 290, 310);
  fill(#567C36);
  quad(220, 180, 220, 310, 200, 290, 200, 180);

  strokeWeight(6); //arm
  line(240, 190, 220+mouseX/10, 220+mouseY/30);
  stroke(255, 255, 255);
  line(180+mouseX/10, 220+mouseY/10, 170+mouseX/10, 235+mouseY/10);
  stroke(#3F522F);
  line(220+mouseX/10, 220+mouseY/30, 180+mouseX/10, 220+mouseY/10);

  strokeWeight(1); //leg
  quad(230, 300, 230, 330, 250, 350, 250, 310);
  fill(#83B954);
  quad(230, 300, 270, 300, 290, 310, 250, 310);
  rect(250, 310, 290, 350);

  fill(255, 255, 255); //toe
  rect(245, 345, 220, 330);
  quad(245, 330, 235, 320, 210, 320, 220, 330);
  quad(220, 330, 220, 345, 210, 335, 210, 320);
}

void mousePressed() {
  frameRate(10);
  fill(#83B954);
  noStroke();
  rect(260, 100, 290, 130);
  fill(0);
  stroke(0);
  rect(260, 125, 290, 130);
}