hqq-secE-project02-variable-faces

hamza

//hamza qureshi
//section e
//project 02
//hqq@andrew.cmu.edu

//here's carl, y'all!

//background color variables
var R_bg = 20;
var G_bg = 225;
var B_bg = 255;
//arm variables
var y_armleft = 400;
var y_armright = 380;
//head variables
var width_head = 280;
var height_head = 90;
var color_head = 120;
//mouth variables
var width_mouth = 200;
var height_mouth = 40;
var color_mouth = 190;
var strokeColor_mouth = 235;
//eyes variables
var rad_eyes = 15;
var rad_pupil = 7;
var x_eye1 = 23

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

function draw(){
    //background
    background(R_bg,G_bg,B_bg);
    //arms
    strokeWeight(20);
    stroke(0,0,color_head - 50);
    line(160,445,100,y_armleft + 5);
    stroke(0,0,color_head);
    line(160,440,100,y_armleft);
    line(485,440,545,y_armright);
    //body
    fill(0,0,color_head - 50);
    strokeWeight(0);
    rect(width/2-30,height/2+150,150,150,20);
    fill(210,180,180);
    stroke(0,0,color_head);
    strokeWeight(40);
    rect(width/2,height/2+150,150,150,20);
    //head
    strokeWeight(0);
    fill(0,0,color_head-50);
    rect(width/2-30,height/2+5,width_head+30,height_head+5,20);
    fill(0,0,color_head);
    rect(width/2,height/2,width_head,height_head,20);
    //mouth
    fill(color_mouth,20,86);
    strokeWeight(10);
    stroke(strokeColor_mouth,30,100);
    rect(width/2,height/2+40,width_mouth,height_mouth,20);
    if (width_head >= 0){
      width_mouth = width_head-20;
    }
    //eyes
    fill(255,255,255);
    strokeWeight(3);
    stroke(0,0,0);
    var left_eye = width/3-height_head*0.5
    var right_eye = left_eye + width/2
    ellipse(left_eye,height/2-30,rad_eyes,rad_eyes);
    ellipse(right_eye,height/2-30,rad_eyes,rad_eyes);
    fill(0,0,0);
    strokeWeight(0);
    ellipse(left_eye,height/2-30,rad_pupil,rad_pupil);
    ellipse(right_eye,height/2-30,rad_pupil,rad_pupil);
    if (rad_eyes >= 0){
      rad_eyes > rad_pupil
    }


}

function mousePressed(){
    R_bg = random(0,40);
    G_bg = random(200,245);
    B_bg = random(245,255);
    width_head = random(200,250);
    height_head = random(110,140);
    color_head = random(120,210);
    width_mouth = random(210,290);
    height_mouth = random(10,30);
    color_mouth = random(180,220);
    strokeColor_mouth = random(235,255);
    rad_eyes = random(10,20);
    rad_pupil = random(2,8);
    y_armleft = random(390,460);
    y_armright = random(390,460);



}

For my variable face project, I made Carl, a frantic little buddy who’s a bit nervous about Picture Day. The photographer keeps snapping photographs, and in each one, he expresses his anxiety by how agape his mouth his, h0w dilated his eyes are, and the way he waves his hands.

Leave a Reply