cespinoz-project-02

my-sketch.js

var cheekWidth = 125
var cheekHeight = 125 
var leftEyeX = 285
var rightEyeX = 365
var leftEyeY = 170
var rightEyeY = 170
var toothHeight = 40

function setup() {
    createCanvas(640,480);
}
function draw() {
    background(255,217,223);
    noStroke();
    fill(139,69,19) //squirrel tail
    rect(345,150,200,325,90,10,95,0)    
    fill(153,102,51); //face and body color
    ellipse(320,200,200,200) //top head
    ellipse(320,280,160,190) //CHIN
    ellipse(260,275,cheekWidth,cheekHeight) //left cheek
    ellipse(380,275,cheekWidth,cheekHeight) //right cheek
    triangle(240,80,240,140,280,120) // left ear
    triangle(400,80,400,140,360,120) // right ear
    rect(250,335,140,225,10,10) //body
    fill(145,95,50) //color for feet
    ellipse(250,475,100,75) //left foot
    ellipse(385,475,100,75) //right foot
    ellipse(250,375,60,60) //left hand
    ellipse(385,375,60,60) //right hand

    fill(97,65,38) //acorn
    triangle(260,375,375,375,320,420)
    rect(310,355,20,20,5,5)
    fill(112,84,59)
    rect(260,365,115,15,10,10)

    //squirrel face
    fill(256);
    ellipse(280,180,65,65)
    ellipse(360,180,65,65) //white eyes
    fill(0);
    ellipse(285,180,55,60) //left color eye
    ellipse(365,180,55,60) //right color eye
    fill(256);
    ellipse(leftEyeX,leftEyeY,30,30) //left pupil
    ellipse(rightEyeX,rightEyeY,30,30) //right pupil
    fill(0) //nose
    ellipse(320,250,75,25) //round nose
    rect(315,250,10,40,5,5) //nose vertical line
    ellipse(320,290,125,5) //mouth
    fill(256) //teeth
    rect(290,292,29,toothHeight,5,5) //left tooth
    rect(320,292,29,toothHeight,5,5) //right tooth

}

function mousePressed() {
   
    cheekHeight = random(100,150);
    cheekWidth = random(100,150); //cheeks change
    leftEyeX = random(275,295) //now eyes change
    rightEyeX = random (355,375) 
    leftEyeY = random(170,190)
    rightEyeY = random(165,190)
    toothHeight =random(30,50)


}

I decided to use a squirrel for my variable-changing face project. To begin, I sketched out an idea of the main head and face onto notebook paper as shown here:

As I started coding, I got more confident with the axes and began to do a fast guess and check as my program got more detailed. I then chose to have the variables of the teeth, pupils, and cheeks change.

Leave a Reply