//Jamie Park jiminp@andrew.cmu.edu
//15-104 Section E Project #2
var bodySize = 130;
var tail = 150;
var eyes = 25;
var pupil = 10;
var faceWidth = 110;
var faceHeight = 150;
var mouth = 70;
var cheeks = 20;
var noseLength = 250
function setup(){
createCanvas(640,480);
}
function draw(){
background(128, 124, 115);
strokeWeight(40);
stroke(217, 180, 98);
noFill();
beginShape();
curveVertex(width / 2 + 50, 640); //tail
curveVertex(width / 2 - 80, 460);
curveVertex(width / 2 - 130, 300);
curveVertex(tail, 200);
endShape();
noStroke();
fill (242, 205, 121);
ellipse (width / 2, height / 2 + 150, bodySize, 250); //body
fill (255, 233, 184);
ellipse (width / 2, height / 2, faceWidth, faceHeight); //face
var eyeLeft = width / 2 - faceWidth * 0.35;
var eyeRight = width / 2 + faceWidth * 0.35;
fill(255, 200, 176);
ellipse (eyeLeft - 3, height / 1.80, cheeks, cheeks); //cheeks
ellipse (eyeRight + 3, height / 1.80, cheeks, cheeks);
fill(250);
ellipse (eyeLeft, height / 2, eyes, eyes); //eyes
ellipse (eyeRight, height / 2, eyes, eyes);
fill(74, 72, 65);
ellipse (eyeLeft, height / 2, pupil, pupil); //pupil
ellipse (eyeRight, height / 2, pupil, pupil);
fill(242,111,63);
arc(width / 2, height / 1.80, mouth, mouth, TWO_PI, PI); //mouth
strokeWeight(2);
stroke (170, 156, 112);
line (width / 2, noseLength, width / 2, height /2 + 3); //nose
fill("pink");
noStroke();
triangle(eyeLeft - 10, height / 2 - 100, eyeLeft - 10, //horn
height / 2 - 27, eyeLeft + 10, height / 2 - 32);
triangle(eyeRight + 10, height / 2 - 100, eyeRight - 10,
height / 2 - 32, eyeRight + 10, height / 2 - 27);
}
function mousePressed(){
bodySize = random (110, 200);
faceWidth = random(90, 170);
faceHeight = random(130, 165);
eyes = random(15, 28);
mouth = random(50, 80);
tail = random (0, 160);
pupil = random(10, 15);
cheeks = random(10, 20);
noseLength = random (245, 260);
}
At first, I was skeptical with my ability to code this project. But once I started, I had a lot of fun altering the features that would fit into my creature! I am still struggling with effectively using curve vertex, but hopefully it will naturally come as I code more things.