//Sarah Choi
//Section D
//sychoi@andrew.cmu.edu
//Assignment-02-A
var noseSize = 20;
var nostrilHeight = 180;
var nostrilWidth = 120;
var eyes = 20
function setup() {
createCanvas(640, 480);
}
function draw() {
background(250, 157, 157);
//nose
stroke(253, 212, 212);
ellipse(width / 2, height / 2, nostrilHeight, nostrilWidth);
stroke(255);
var nostrilL = width / 2 - nostrilHeight * 0.25;
var nostrilR = width / 2 + nostrilHeight * 0.25;
ellipse(nostrilL, height / 2, noseSize, noseSize);
ellipse(nostrilR, height / 2, noseSize, noseSize);
//eyes
noFill();
strokeWeight(5);
var eyesL = width / 2 - nostrilHeight * 0.3;
var eyesR = width / 2 + nostrilHeight * 0.3;
arc(eyesL, height / 3, noseSize * 1.1, noseSize * 2, PI, TWO_PI);
arc(eyesR, height / 3, noseSize * 1.1, noseSize * 2, PI, TWO_PI);
//legs
var legsL = width / 3.5;
var legsR = width /1.5;
arc(legsL, height / 1.2, noseSize + 10, noseSize + 20, 0, PI, OPEN);
arc(legsR, height / 1.2, noseSize + 10, noseSize + 20, 0, PI, OPEN);
var legsLB = width / 3
var legsRB = width / 1.4
arc(legsLB, height / 1.2, noseSize + 10, noseSize + 20, 0, PI, OPEN);
arc(legsRB, height / 1.2, noseSize + 10, noseSize + 20, 0, PI, OPEN);
//tail
bezier(125, 200, 130, 160, 180, 180, 110, 190);
bezier(125, 200, 125, 220, 190, 170, 150, 190);
bezier(150, 190, 110, 220, 160, 220, 160, 210);
}
function mousePressed() {
// when the user clicks, these variables are reassigned
// to random values within specified ranges. For example,
// 'faceWidth' gets a random value between 75 and 150.
nostrilHeight = random(100, 200);
nostrilWidth = random(75, 150);
noseSize = random(5, 30);
eyesL = random(10, 30);
eyesR = random(10, 30);
legsL = random(10, 30);
legsR = random(10, 40);
}
I played around from the template, and I started getting more ideas. I wanted to create an animal and the first thing I thought of was a pig. This is an outline of prominent features of pigs I wanted to portray.