serinal (section C) – project 02

*i’m not sure why the thing is getting cut off, but TECHNICALLY if you zoom out, it should work out*

sketch

// Serina Liu 
// Section C
// serinal@andrew.cmu.edu
// Project 02, Changing Faces

var eye = 40;
var faceWidth = 150;
var faceHeight = 200;
var mouthSize = 25;
var featherwidth = 30;
var featherheight = 60;
var beaklength = 160;
var pupilsize = 10;
var buttfeathers = 495;
var brow = 5; 
var browtilt = 130; 
//colors
var cR = 240;
var cG = 100; 
var cB = 192; 
//eyebrow
var eyebrows = 10;
 
function setup() {
    createCanvas(640, 480);
}
 
function draw() {
    background(178, 255, 102);
    //head
    fill(256, 256, 256);
    rect(320, 240, faceWidth,  faceHeight);
    //top part of head 
    fill (220);
    rect (320, 240, faceWidth, faceHeight/2);
    //eyes
    fill(0, 0, 0);
    var eyeLX = 320 - faceWidth * 0.1;
    var eyeRX = 320 + faceWidth * 0.2;
    ellipse(eyeLX +10, height / 2, eye, eye);
    ellipse(eyeRX +10, height / 2, eye, eye);
    //eyepupils
    fill(256, 256, 256);
    ellipse (eyeLX+5, height/2, pupilsize, pupilsize);
    ellipse (eyeRX+5, height/2, pupilsize, pupilsize);
    //mouth
    fill(255, 255, 0);
    triangle(200, height/2 + 40, 360, 280, 360, 330);
    //mouthpiece2
    fill(255, 255, 0);
    triangle(beaklength, height/2 + 60, 360, 330, 360, 380);
    //head piece
    fill (255, 0, 0);
    ellipse(460, 240, featherwidth, featherheight);
    ellipse (470, 250, featherwidth, featherheight);
    ellipse (480, 260, featherwidth, featherheight);
    //butt feathers
    fill (256, 256, 256);
    triangle (buttfeathers, height/2 +120, 420, 390, 490, 4000);
    //underchin 
    fill (255, 0, 0);
    ellipse (350, 390, featherwidth, featherheight);
    ellipse (330, 390, featherwidth, featherheight);
    ellipse (370, 390, featherwidth, featherheight);
    //text
    fill(250, cG, cB);
    textSize(20);
    text("hello i am a chicken", 235, 145, 500, 500);
    //text
    fill(cR, 180, cB);
    textSize(20);
    text("hello i am a chicken", 450, 145, 500, 500);
    //text
    fill(cR, cG, 180);
    textSize(20);
    text("hello i am a chicken", 20, 145, 500, 500);
    //text
    fill (76, 153, 0);
    textSize (100);
    text("i am a chicken", 1, 30, 700, 700);
    //eyebrows
    fill(0,0,0);
    rect(eyeLX+7, 203, 30, eyebrows);
    rect(eyeRX+7, 203, 30, eyebrows);
}
 
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.
    faceWidth = random(130, 165);
    faceHeight = random(300, 400);
    eye = random(10, 30);
    mouthSize = random(80, 100);
    featherwidth = random(30,60);
    featherheight = random(30, 60);
    beaklength = random(40, 120);
    pupilsize = random(7, 15);
    buttfeathers = random(40, 150);
    cR = random(1, 256);
    cG = random(1, 256);
    cB = random(1, 256);
    eyebrows = random(5, 15);
}

This particular project was kind of a challenge for me just because I was having trouble really understanding variables in general. However, once I started to understand the meaning of a variable, I was more easily able to code something. I knew I wanted to do an animal and I wanted to keep the colors of the chicken stable so I tried to manipulate all the other stuff that is involved with it. The text changing color was a fun little thing. Overall, I guess that I would love to have a bit more time to explore and refine my ideas. I think it would probably be helpful to actually sketch out my ideas prior to making it, but as of now and as of the level I am at, I think that it satisfies my standards.

Leave a Reply