Project 2, odh

odh-variables

//Owen D Haft
//Section D
//odh@andrew.cmu.edu
//Project 02
    
var headX = 200;
var headY = 300;
var earX = 60;
var earY = 100;
var eyeX = 50;
var eyeY = 50;
var eyeU = 25;
var eyeV = 25;
var musX = 100;
var musY = 80;

function setup() {
    createCanvas(640, 480);
    
}

function draw() {

    background(64, 64, 154);
    noStroke(0);

//body
    fill(200, 0, 0)
    arc(320, 480, 150, 100, PI, PI);
    
//neck
    fill(247, 231, 197);
    rect(300 ,340 ,40 , 100);

//ears
    ellipse(200, 230, earX, earY);
    ellipse(440, 230, earX, earY);

//head
    ellipse(320, 260, headX, headY);

//eyes
    fill(255);
    ellipse(275, 220, eyeX, eyeX);
    ellipse(365, 220, eyeY, eyeY); 

//pupils
    fill(0, 0, 0);
    ellipse(275, 220, eyeU, eyeU);
    ellipse(365, 220, eyeV, eyeV);   

//mustache
    fill(120, 100, 60)
    arc(320, 310, musX, musY, PI, PI)

}

function mousePressed(){

    earX = random(50, 100);
    earY = random(80, 120);
    headX = random(200, 250);
    headY = random(300, 350);
    eyeX = random(40, 75);
    eyeY = random(40, 75);
    eyeU = random(6, 36);
    eyeV = random(6, 36);
    musX = random(80, 120);
    musY = random(75, 85);

}

I worked primarily with simpler geometries while experimenting with the variables. I played with using the same variables for both the “x” and “y” of certain shapes, like the eyes and pupils, allowing them to change independent of each other.

Leave a Reply