Nayeon_Project02_Variable face

nayeon-variable_faces

//Na-yeon Kim
//15-104, B section
//nayeonk1@andrew.cmu.edu
//Project-02_Variable Faces


var pupil = 70;
var eyeS = 100;
var faceW = 300;
var faceH = 240;
var bodyW = 300;
var bodyH = 300;
var feetW = 50;
var feetH = 60;
var wingW = 100;
var wingH = 170;
var r = 166;
var g = 95;
var b = 38;
var dir = 1;
var speed = 0.5;



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

function draw() {
    background(250);
    noStroke();

//body
    fill(r, g, b);
    ellipse((width / 2), 420, bodyW, bodyH);

//ears
    push();
    translate(160, 200);
    rotate(30);
    translate(-160, -200);
    arc(150, 220, 180, 130, 0, 180);
    pop();

    push();
    translate(350, 350);
    rotate(-30);
    translate(-350, -350);
    arc(400, 220, 180, 130, 0, 180);
    pop();


//head
    ellipse((width / 2), (height / 2), faceW, faceH);

    fill(235, 207, 174);
    ellipse((width / 2), (height / 2) + 10, (faceW - 50), (faceH - 30));

    fill(207, 145, 74);
    ellipse((width / 2) - 50, (height / 2), eyeS + 40, eyeS + 20);
    ellipse((width / 2) + 50, (height / 2), eyeS + 40, eyeS + 20);

//eyes
    fill(260);
    ellipse((width / 2) - 50, (height / 2), eyeS, eyeS);
    ellipse((width / 2) + 50, (height / 2), eyeS, eyeS);

    fill(r -100, g -100, b -100);
    ellipse((width / 2) - 50, (height / 2), pupil, pupil);
    ellipse((width / 2) + 50, (height / 2), pupil, pupil);

    pupil += dir * speed;
    if (pupil > 80) {
        dir = -dir;
        pupil = 80;
    } else if (pupil < 50) {
        dir = -dir;
        pupil = 50;
    }

//beak
    fill(219, 164, 0);
    ellipse((width / 2), (height / 2) + 40, 40, 70);

//feet
    ellipse((width / 2) - 50, 570, feetW, feetH);
    ellipse((width / 2) + 50, 570, feetW, feetH);

//feather
    fill(235, 207, 174);
    triangle((width / 2) - 30, 450, (width / 2) -20, 470, (width / 2) -10, 450);
    triangle((width / 2) - 10, 450, (width / 2), 470, (width / 2) + 10, 450);
    triangle((width / 2) + 30, 450, (width / 2) +20, 470, (width / 2) +10, 450);


//wings
    fill(r -20, g -20, b -20)
    ellipse((width / 2) - 120, 480, wingW, wingH)
    ellipse((width / 2) + 120, 480, wingW, wingH)

}

function mousePressed() {

    faceW = random(250, 350);
    faceH = random(200, 280);
    eyeS = random(80, 120);
    pupil = random(50, 90);
    bodyW = random(250, 350);
    bodyH = random(250, 350);
    feetW = random(30, 70);
    feetH = random(50, 90);
    wingW = random(70, 130);
    wingH = random(150, 200);
    r = random(130, 190);
    g = random(70, 115);
    b = random(0, 50);

  }

 

I made a draft of a cute owl and painted it with Photoshop, and started to code shapes. Now it became bit odd for ordinary owl, but I like the randomness shapes of this creature!

Leave a Reply