cduong-Project02-Variable Faces-SectionD

project02variablefaces

/*
Name: Colleen Duong
Class Section: D; 9:30AM
Email: cduong@andrew.cmu.edu
Project-02-Variable Faces
*/

//List of Variables that are used for the Front Character
var eyeSize = 20;
var faceWidth = 200;
var faceHeight = 200;
var Blush = 60;
var Mouth = 30;
var Sprout = 30;
var BodyShake = 300;

//List of Variables for the background Characters
var ShadowPosseHead = 100;
var ShadowPosseBody = 200;
var ShadowBack = 0;
var ShadowMiddle = 30;
var ShadowFront = 60;


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

function draw() {
    background(137, 0, 0);
    noStroke();

    //Stalkers Body (Left/Black). The variables will make the shapes move left and right frequently
    fill(ShadowBack);
    ellipse(ShadowPosseBody+80, 450, ShadowPosseHead, ShadowPosseHead);
    ellipse(ShadowPosseBody+130, 450, ShadowPosseHead, ShadowPosseHead);
    ellipse(ShadowPosseBody+150, 420, ShadowPosseHead, ShadowPosseHead);
    ellipse(ShadowPosseBody-100, 450, ShadowPosseHead, ShadowPosseHead);
    ellipse(ShadowPosseBody-200, 450, ShadowPosseHead, ShadowPosseHead);

    //Stalkers Body (Left/DarkGrey). The variables will make the shapes move left and right frequently
    fill(ShadowMiddle);
    ellipse(ShadowPosseBody, 350, ShadowPosseHead, ShadowPosseHead);
    rect(ShadowPosseBody, 380, 20, 40, 10);
    arc(ShadowPosseBody+10, 440, 70, 70, PI, 0);
    rect(ShadowPosseBody-30, 430, 75, 70, 10);
    ellipse(ShadowPosseBody-100, 370, ShadowPosseHead, ShadowPosseHead);
    rect(ShadowPosseBody-100, 400, 20, 40, 10);
    arc(ShadowPosseBody-90, 460, 70, 70, PI, 0);
    rect(ShadowPosseBody-125, 460, 70, 70);

    //Stalkers Body (Left/LightGrey). The variables will make the shapes move left and right frequently
    fill(ShadowFront);
    ellipse(ShadowPosseBody-50, 400, ShadowPosseHead, ShadowPosseHead);
    rect(ShadowPosseBody-50, 430, 20, 40, 10);
    arc(ShadowPosseBody-40, 490, 70, 70, PI, 0);
    rect(ShadowPosseBody-80, 480, 75, 70, 10);
    ellipse(ShadowPosseBody+80, 400, ShadowPosseHead, ShadowPosseHead);
    rect(ShadowPosseBody+80, 430, 20, 40, 10);
    arc(ShadowPosseBody+90, 490, 70, 70, PI, 0);
    rect(ShadowPosseBody+60, 480, 75, 70, 10);
    ellipse(ShadowPosseBody-150, 400, ShadowPosseHead-10, ShadowPosseHead-10);
    rect(ShadowPosseBody-150, 430, 20, 40, 10);
    arc(ShadowPosseBody-140, 485, 70, 70, PI, 0);
    rect(ShadowPosseBody-170, 480, 75, 70, 10);

    //Stalkers Body (Right/Black). The variables will make the shapes move left and right frequently
    fill(ShadowBack);
    ellipse(ShadowPosseBody+300, 450, ShadowPosseHead, ShadowPosseHead);
    ellipse(ShadowPosseBody+400, 450, ShadowPosseHead+10, ShadowPosseHead+10);
    ellipse(ShadowPosseBody+200, 450, ShadowPosseHead, ShadowPosseHead);

    //Stalkers Body (Right/DarkGrey). The variables will make the shapes move left and right frequently
    fill(ShadowMiddle);
    ellipse(ShadowPosseBody+300, 350, ShadowPosseHead, ShadowPosseHead);
    rect(ShadowPosseBody+300, 380, 20, 40, 10);
    arc(ShadowPosseBody+310, 440, 70, 70, PI, 0);
    rect(ShadowPosseBody+280, 430, 75, 70, 10);
    ellipse(ShadowPosseBody+200, 370, ShadowPosseHead, ShadowPosseHead);
    rect(ShadowPosseBody+200, 400, 20, 40, 10);
    arc(ShadowPosseBody+210, 460, 70, 70, PI, 0);
    rect(ShadowPosseBody+180, 445, 70, 70);

    //Stalkers Body (Right/LightGrey). The variables will make the shapes move left and right frequently
    fill(ShadowFront);
    ellipse(ShadowPosseBody+250, 400, ShadowPosseHead, ShadowPosseHead);
    rect(ShadowPosseBody+250, 430, 20, 40, 10);
    arc(ShadowPosseBody+260, 490, 70, 70, PI, 0);
    rect(ShadowPosseBody+230, 480, 75, 70, 10);
    ellipse(ShadowPosseBody+380, 400, ShadowPosseHead, ShadowPosseHead);
    rect(ShadowPosseBody+380, 430, 20, 40, 10);
    arc(ShadowPosseBody+390, 490, 70, 70, PI, 0);
    rect(ShadowPosseBody+360, 480, 75, 70, 10);

    //Face Shape. Variables makes the face change size.
    fill(256);
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);

    //Blush. Variables makes blush change size in correlation with the eyes.
    var eyeLX = width / 2.1 - faceWidth * 0.25;
    var eyeRX = width / 2.1 + faceWidth * 0.25;
    fill(255, 114, 129);
    ellipse(eyeLX, 270, Blush, Blush);
    ellipse(eyeRX+20, 270, Blush, Blush);

    //Eyes. Variables makes blush change size in correlation with the head.
    fill(0);
    rect(eyeLX, height / 2.3, eyeSize, eyeSize*2, 10);
    rect(eyeRX, height / 2.3, eyeSize, eyeSize*2, 10);

    //Mouth. Variable makes mouth change size.
    fill(0);
    arc(310, 290, Mouth, Mouth, PI, 0);

    //Sprout. Variable makes sprout grow in height
    fill(201, 208, 126);
    ellipse(290, 100, 50, 30);
    ellipse(340, 100, 50, 30);
    rect(305, 100, 20, Sprout+30, 10);

    //Body. Variable makes body move right to left to make it look as though it's shaking.
    fill(256);
    rect(BodyShake+5, 310, 35, 50, 10);
    arc(BodyShake+30, 390, 100, 100, PI, 0);
    rect(BodyShake-20, 385, 100, 100);
}

function mousePressed() {
    faceWidth = random(180, 220);
    faceHeight = random(180, 220);
    eyeSize = random(10, 30);
    Blush = random(50, 70);
    ShadowPosseBody = random(190, 210);
    Mouth = random(10, 50);
    Sprout = random(20, 30);
    ShadowBack = random(0, 20);
    ShadowMiddle = random(30, 50);
    ShadowFront = random(60, 80);
    BodyShake = random(295, 305);

}

For my code I wanted to draw a character that I tend to doodle a lot.

Initially I wanted to make the sprout look evil and scary, but after coding it I realized it wasn’t really possible with it’s basic characteristics, which were ellipse eyes, blush, and a big sprout coming out of its head. So after coding the sprout and making the facial features and the sprout move I decided to continue with my “evil and scary” idea and made these shadow-like creatures behind my sprout character. Initially I was going to just leave them there but I wanted them to move a little as if they were moving towards the sprout character.

At this point I thought I was done but I thought having the sprout character’s body stay still made the entire picture look a bit static when it was clicked on, so I decided to make it look as though the sprout character’s body was shaking as the shadows behind it were coming after it.

My ideas did not really come in an orderly manner so my code was a bit difficult to work with and a bit unorganized, but hopefully it is easier to read after I added some comments to it.

Isabelle Vincent Project-02

sketch

var eyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var earWidth = 10;
var earHeight = 10;
var FacecolorPt1 = 100;
var FacecolorPt2 = 100;
var FacecolorPt3 = 100;
var StrokecolorPt1 = 0;
var StrokecolorPt2 = 0;
var StrokecolorPt3 = 0;
var thic = 1;
var y1 = 220;
var y2 = 260;
function setup() {
    createCanvas(640, 480);
}

function draw() {
    background(51, 153, 102);
    //body
    fill(0);
    stroke(0);
    triangle(320 - faceWidth/2 - 40 , 480 , 320 , 240 , 320 + faceWidth/2 + 40,480);
    //face elliplse
    fill(FacecolorPt1, FacecolorPt2, FacecolorPt3);
    stroke(StrokecolorPt1, StrokecolorPt2, StrokecolorPt3);
    ellipseMode(CENTER);
    ellipse(320, 240, faceWidth,  faceHeight);
    //eye ellilpse
    fill(0);
    var eyeLeftX = width / 2 - faceWidth * 0.25;
    var eyeRightX = width / 2 + faceWidth * 0.25;
    ellipse(eyeLeftX, height / 2, eyeSize, eyeSize);
    ellipse(eyeRightX, height / 2, eyeSize, eyeSize);
    //nose
    stroke(0);
    strokeWeight(thic);
    line(320,y1,320,y2);
    //hat
    triangle(320 - faceWidth/2 , 240 - faceHeight/2, 320, 0, 320 + faceWidth/2, 240 - faceHeight/2);
    rectMode(CORNERS);
    rect(320 - faceWidth/2 - 30, 240 - faceHeight/2 - 20, 320 + faceWidth/2 + 30, 240 - faceHeight/2 + 20);
    //Cauldron
    stroke(0);
    strokeWeight(5);
    fill(0);
    ellipseMode(CORNER);
    ellipse(10,430,50,50);
    rectMode(CORNER);
    rect(5,425,60,20);
    //Cursor Egg
    fill(255);
    strokeWeight(3);
    stroke(255);
    ellipse(mouseX,mouseY,20,30);
}

function mousePressed() {
    faceWidth = random(50, 400);
    faceHeight = random(100, 340);
    eyeSize = random(10, 30);
    earHeight = random(10,25);
    FacecolorPt1 = random(10,255);
    FacecolorPt2 = random(10,255);
    FacecolorPt3 = random(10,255);
    StrokecolorPt1 = random(0,255);
    StrokecolorPt2 = random(0,255);
    StrokecolorPt3 = random(0,255);
    thic = random(1,10);
    y1 = random(240 - eyeSize, 240 - eyeSize);
    y2 = random(y1 + 5,y1 + 30);
}

I used the given template as my basis; I changed some of the original framework and built on top of it. After randomizing the skin color I decided to make the faces into witches because most of the randomized skin colors look non-human and similar to a cartoon witch.

dnoh-sectionD-project02-variableface

sketch

/*
Daniel Noh
Section D
dnoh@andrew.cmu.edu
Project-02
*/

var yolkSize = 230;
var eggX = 0;
var eggY = 0;
var eggA = 0;
var eggB = 0;
var rEye = 20;
var lEye = 20;
var r = -15;
var g = -15;
var b = 15;
var bubbleSize = 30;

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

function draw() {
//fryingpanback
  stroke(0);
  strokeWeight(7);
  fill(40);
  ellipse(320, 480, 1000, 1000);
  noStroke();
  fill(60);
  ellipse(320, 480, 850, 850)

//egg white shape
  fill(240+b, 240+b, 240+b);
  stroke(0);
  strokeWeight(7);

  beginShape();
  curveVertex(100+eggX, 540+eggY);
  curveVertex(100+eggX, 540+eggY);
  curveVertex(80+eggX, 400+eggY);
  curveVertex(110+eggA, 300+eggB);
  curveVertex(200+eggB, 250+eggX);
  curveVertex(320+eggX, 150+eggA);
  curveVertex(440+eggB, 250+eggY);
  curveVertex(530+eggY, 300+eggB);
  curveVertex(560+eggX, 400+eggA);
  curveVertex(540+eggA, 540+eggB);
  curveVertex(540+eggA, 540+eggB);
  endShape();

//yolk face
  fill(255+r, 255+g, 0+b);
  stroke(0);
  strokeWeight(7);
  ellipse(320, 450, yolkSize, yolkSize);

//eyes
  fill(0);
  noStroke();
//uppereye
  ellipse(270+r, 460+r, bubbleSize+r+10, bubbleSize+r+10);
//lowereye
  ellipse(320+g, 400+r, bubbleSize, bubbleSize);

//mouth
  stroke(0);
  ellipse(340, 480, bubbleSize+20+eggA, bubbleSize+40+b);
}

function mousePressed() {
  eggX = random(-25, 25);
  eggY = random(-25, 25);
  eggA = random(-25, 25);
  eggB = random(-25, 25);
  r = random(-15, 0);
  g = random(-25, 0);
  b = random(0, 25);
  yolkSize = random(200, 230);
  bubbleSize = random(20, 25);
  clear();
}

I honestly went directly to coding only knowing that I wanted to create a dynamic egg face, so at first I was slightly confused. I plotted points down relative to the overall canvas and went from there. I reused several randomized variables for different things, which made my code a bit unorganized. However, I am content with my final product.

mmirho – Project 2 – Section A

I kept the structure of the face very similar to the original template because I thought it allowed me to experiment the most with the code and variation without worrying too much about the physical appeal

I was able to create a large amount of variation as a result, although the face is quite simple.

SORRY!
I’m really sorry, but would it be alright would it be alright if you let my incompetence slide this time. I followed the embedding instructions to the tee, and even compared it with my old post (Which I put below for reference) but my program still won’t show up. I would love it if you could take the time to paste my code into your own text editor, I assure you it works fine, the only thing that got hung up was my embedding.

I would love to schedule some office hours on this topic because it’s clear I’m missing something. Thanks! I hope I won’t get points off. I would appreciate a comment on my post or an email if you want to talk about it.

Max’s Face

function setup() {
    createCanvas(640, 480);
    mouth2 = PI - 0.2;
}
var leftEyeSize = 20;
var rightEyeSize = 20;
var faceWidth = 100;
var faceHeight = 150;
var noseHeight = 15;
var noseLength = 10;
var mouthHeight = 15;
var mouthLength = 10;
var mouthType = 5;
var pupilH = 1;
var pupilV = 1;
var mouth1 = 0.2;
var mouth2 = 3; // fix above to PI - 0.2;
var mouthFlat = 2*mouthHeight;
var moveUp = 0;
var moveNoseUp = 0;
function draw() {
    background(180);
    fill(250);
    fill(230, 200, 255);
    ellipse(width/2, height/2, faceWidth, faceHeight);
    var heightOrientation = height/2 + faceHeight/10;
    arc(width/2, heightOrientation + faceHeight/3.5 - moveUp, 2*mouthLength, mouthFlat, mouth1, mouth2);
    fill(230, 200, 255);
    arc(width/2 + noseLength, heightOrientation - moveNoseUp, 2*noseLength, 2*noseHeight, HALF_PI, PI);
    fill(250);
    line(width/2, heightOrientation + noseHeight - moveNoseUp, width/2 + noseLength, heightOrientation + noseHeight - moveNoseUp);
    var eyeLeftOri = width / 2 - faceWidth * 0.25;
    var eyeRightOri = width / 2 + faceWidth * 0.25;
    ellipse(eyeLeftOri, height/2, leftEyeSize, leftEyeSize);
    ellipse(eyeRightOri, height/2, rightEyeSize, rightEyeSize);
    ellipse(eyeLeftOri + pupilH, height/2 + pupilV, leftEyeSize/3, leftEyeSize/3);
    ellipse(eyeRightOri + pupilH, height/2 + pupilV, rightEyeSize/3, rightEyeSize/3);
    
}
function mousePressed() {
    eyeLeftOri = width/2 - faceWidth*1/random(3,6);
    eyeRightOri = width/2 + faceWidth*1/random(3,6);
    pupilH = random(-5, 5);
    pupilV = random(-5, 5);
    faceWidth = random(75, 150);
    faceHeight = random(100, 200);
    leftEyeSize = random(20, 30);
    noseHeight = random(8, 25);
    noseLength = random(5,10);
    mouthHeight = random(10, 15);
    mouthLength = random(10, 20);

    randomEye = random(1,40);
    if(randomEye < 5) {
        rightEyeSize = random(20,30);
    }
    else {
        rightEyeSize = leftEyeSize;
    }

    mouthType = random(0,100);
    if(mouthType < 40) {
        mouth1 = 0.2;
        mouth2 = (PI-0.2);
        mouthFlat = 2*mouthHeight;
        moveUp = 20;
    }
    else if (mouthType > 60) {
        mouth1 = (PI+0.2);
        mouth2 = -0.2;
        mouthFlat = 2*mouthHeight;
        moveUp = 0;
        moveNoseUp = 15;
    }
    else {
        mouth1 = 0.2;
        mouth2 = PI-0.2;
        mouthFlat = 1;
        moveUp = 0;
    }
}

Face

function setup() {
    createCanvas(500, 500);
    background(250, 250, 250);
}

function draw() {

    fill(255, 224, 189); //skin color
    noStroke();

    //Head
    rectMode(CENTER);
    ellipse(width/2, (height/2), 140, 160);

    //Cut off the top of head
    fill(250);
    rect(width/2, (height/2)-150, 140, 160); 
    fill(255,224,189);

    //Ears
    arc((width/2)-50,(height/2),60,50,3*PI/2+PI,3*PI/2,OPEN);
    arc((width/2)+50,(height/2),60,50,3*PI/2,3*PI/2,OPEN);

    //Mouth
    stroke(0);
    line(250, 310, 220, 300);
    noStroke();

    //Nose
    fill(0);
    triangle(250, 255, 265, 285, 250, 285);
    fill(255, 224, 189);
    triangle(247, 253, 262, 283, 247, 283);

    //Hair
    fill(255, 226, 60);
    triangle(237, 195, 197, 195, 240, 155);
    triangle(257, 195, 217, 195, 260, 155);
    triangle(277, 195, 237, 195, 280, 155);
    triangle(297, 195, 257, 195, 300, 155);

    //Eyes
    fill(0);
    stroke(0);
    strokeWeight(3);
    fill(255);
    ellipse((width/2)+30, (height/2)-10, 25, 15);
    ellipse((width/2)-30, (height/2)-10, 25, 15);

    //Irises
    fill(0,0,200); 
    stroke(0);
    ellipse((width/2)+32, (height/2)-10, 12, 14);
    ellipse((width/2)-28, (height/2)-10, 12, 14);

    //Pupils
    noStroke(); 
    fill(0);
    ellipse((width/2)+32, (height/2)-10, 5, 5);
    ellipse((width/2)-28, (height/2)-10, 5, 5);


}

Project-02-Variable-Face-The Dango

sijings-02
My intention for this project is to create a narrative story around the given instructions. When I first started the project, I want to do something with the shape of the face, such as dividing the face from the middle and have a new face coming out of it. My changing variables here are the blush’s color, the eyes’ movements, the mouth’s size, face’s movement and size at the last two clicks. When I nearly finished the project, I wanted to create a completely different image from what I had. I wanted to scale the face and complete my narration (which is, the emotions of a “dango”(a Japanese riceball snack) when it is being pierced through by a stick). To achieve this, I used several variables to control my clicks, for example, I used “var deter” in my coding work. Therefore, a new image will appear when I click my mouse.

//clair(sijing) sun
//session C
//sijings@andrew.cmu.edu
//Project-02-Variable-Face

var eyeSize1 = 10;
var eyeSize2 = 15;
var faceWidth = 350;
var faceHeight = 300;
var blushW=30;
var eyeLX = 640 / 2 - 122.5;//note, do not use width here
var eyeRX = 640 / 2 + 157.5;
var dir=1;//for chaning direction
var deter=1; //to determine when to call out different part of drawings
var deter2=1;
var deter3=1;
var deter4=1;
var color1=109; //for color randomnization
var color2=109;
var color3=109;
var mouthopen=2;
var hairlength=50;
var mouthlength=130;



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


function draw() {
    //First Face
    background(246,246,246);//called again later
    fill(246,246,246);
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    fill(39,40,34);
    ellipse(eyeLX, height / 2+20, eyeSize1, eyeSize2);//all used variables here for later randomnization
    ellipse(eyeRX, height / 2+35, eyeSize2, eyeSize1);
    ellipse(eyeLX, height / 2+22, eyeSize1-5, eyeSize2);
    ellipse(eyeRX, height / 2+37, eyeSize2-5, eyeSize1);
    fill(246,246,246);
    noFill();
    arc(width/2, height/2+20, 60, 60, 90, 180);
    
    //Left eyebrow
    arc(width/2-135, height/2-25, 120, 20, 0, 90);
    
    //right eyebrow
    noFill();
    line(width-210,height/2+10,width-170,height/2+25);
    stroke(126);
    line(width-205,height/2+11,width-170,height/2+26);
    stroke(126);
    line(width-190,height/2+20,width-170,height/2+28);
    line(width-183,height/2+24,width-170,height/2+30);
    stroke(255);
    
    //Left Check
    stroke(109,109,109,150);
    fill(color1,color2,color3,150);
    ellipse(width/2-120, height/2+40, blushW+20, blushW);
    noFill();
    ellipse(width/2-119, height/2+39, blushW+21, blushW-1);//to create strokes effect
    ellipse(width/2-122, height/2+38, blushW+23, blushW-1);
    stroke(43,43,43,100);
    ellipse(width/2-120, height/2+38, blushW+23, blushW+2);
    
    //Right Check
    stroke(109,109,109,150);
    fill(color1,color2,color3,150);
    ellipse(width/2+130, height/2+60, blushW+25, blushW+17);
    noFill();
    ellipse(width/2+132, height/2+61, blushW+25, blushW+16);
    ellipse(width/2+131, height/2+59, blushW+24, blushW+17);
    stroke(43,43,43,100);
    ellipse(width/2+132, height/2+61, blushW+30, blushW+17);
    stroke(43,43,43);

    //moving eyes
    if (deter==2) {//for making them shaking(later realized that random can do the same work)
        eyeLX += dir * 1;
        eyeRX += dir * 1;
        if (eyeLX > 199.2 || eyeLX < 195.2 ) {
            dir = -dir;
        }
    }

    //mouth
    fill(196,208,67);
    ellipse(width/2+30,height/2+100,mouthlength,mouthopen);

    
    //Third Condition
    if (deter3>2&deter3<6){
        strokeWeight(7);
        line(width/2+40,0,width/2,height/2-60);
        line(width/2-38,width/2+70,259,height);
        strokeWeight(3);
        stroke(167,167,167);
        line(width/2+44,0,width/2+3,height/2-60);
        line(width/2-35,width/2+69,264.5,height);
        noFill();
        angleMode(DEGREES);
        arc(width/2, height/2-60, 20, 20, 60, 120);
        stroke(0,0,0);
        strokeWeight(1);
    }    

    //Fourth Condition
    if (deter4>3){
        background(246,246,246);
        ellipse(width/2+40,100,70,70);
        ellipse(width/2,200,70,70);
        ellipse(width/2-40,300,70,70);
        fill(0,0,0);
        ellipse(width/2-60,310,5,10);
        ellipse(width/2-32,317,5,10);
        stroke(0,0,0);
        strokeWeight(3);
        line(width/2+80,0,width/2+50,80);
        line(width/2+30,132.8,width/2+7,187);
        line(width/2-10,233,width/2-38,294);
        line(width/2-53,332,width/2-75,380);
        noFill();
        arc(width/2+50, 70, 20, 20, 60, 120);
        arc(width/2+5, 179, 20, 20, 60, 120);
        arc(width/2-37, 287, 20, 20, 60, 120);



    }
}
    

function mousePressed() {
    deter=2;
    deter2+=1;//for calculating how many times should the face change
    deter3+=1;
    deter4+=0.5;
    color1=random(180,250);
    color2=random(10,86);
    color3=random(70,103);
    mouthopen=random(5,30);
    mouthlength=random(1,140);
    faceWidth = random(350,500);

}
    

jknip-Project-02-variable-face

sketch.js

/*Jessica Nip
Section A
jknip@andrew.cmu.edu
Project-02 */

var eyeSize = 20;
var cheekSize = 20;
var faceWidth = 120;
var faceHeight = 150;
var et = 15;
var value = 150;
var faceR = 179;
var faceG = 229;
var faceB = 178;
var cheekR = 235;
var cheekG = 189;
var cheekB = 176;

function setup() {
    createCanvas(640, 480);
}
 
function draw() {
	background(value);
    var b = color(179,229,178);
	fill(256);
    noStroke();
    ellipse(width / 2, height / 2, faceWidth,  faceHeight);
    fill(faceR, faceG, faceB);
    ellipse(width / 2+3, height / 2+3, faceWidth,  faceHeight);
    fill(b);
    ellipse(360,119,et,et*1.1);
    var eyeLX = width / 2 - faceWidth * 0.25;
    var eyeRX = width / 2 + faceWidth * 0.25;
    var c = color(0);
    fill(c);
    ellipse(eyeLX, height / 2.1, eyeSize, eyeSize*2);
    ellipse(eyeRX, height / 2.1, eyeSize, eyeSize*2);
    fill(cheekR,cheekG,cheekB);
    ellipse(eyeLX, height / 1.85, cheekSize/2, cheekSize/3); //cheeks
    ellipse(eyeRX, height / 1.85, cheekSize/2, cheekSize/3);
    var green = color(1,146,79);
    noFill();
    stroke(b);
	beginShape();
	curveVertex(374,191);
	curveVertex(358,119);
	curveVertex(311,117);
	curveVertex(322,200);
	curveVertex(322,200);
	endShape();
	fill(green);
	noStroke();
	ellipse(315, height/1.85, eyeSize/5, eyeSize/5); //nostrils
    ellipse(325, height/1.85, eyeSize/5, eyeSize/5);
}

function mouseMoved() {
	value = value +5;
	if (value>255) {
		value = 0;
	}
}
 
function mousePressed() {
    faceWidth = random(80, 150);
    faceHeight = random(80, 150);
    et =random(5,40);
    eyeSize = random(10, 25);
    cheekSize = random(15,30);
    faceR = random(180,250);
    faceG = random(150,250);
    faceB = random(130,200);
    cheekR = random(120,150);
    cheekG = random(100,120);
    cheekB = random(100,130);

}

I wanted to create an interactive alien face that utilizes different pops of pastel for its face and cheek. I found that when setting different scales for the ellipses, they easily formed interesting facial compositions.

ghou-project-02-VariableFace

I really liked the googly-eyes, I feel like it added a little more dynamic to this drawing. There definitely could be more characteristics varied but I think the image should stay somewhat recognizable.

sketch

//Grace Wanying Hou
//15-104 Section D
//ghou@andrew.cmu.edu
//Assignment 02

var faceWidth = 200;
var faceHeight = 250;
var earsize = 100;
var eyesize = 20
var mouthsize = 50;

var faceround = 10;
var earround = 20;

//each of these features have 3 types that will get chosen when clicked 
var facet = 1;
var eart = 1;
var types =[1,2,3];
//colours
var facer = 255;
var faceg = 220;
var faceb = 200;
var eyer = 255;
var eyeg = 255;
var eyeb = 255;

// setting the canvas and changing rectangle mode to center
function setup() {
    createCanvas(480,640);
    rectMode(CENTER);
}


function draw() {
    //background will always be in a darker shade than the face
    background(facer-150, faceg-150, faceb-150);
    fill (facer, faceg, faceb);
    
    stroke(facer+25,faceg+25,faceb+25);
    strokeWeight(20);
    
    
    //types of ears
    if(eart == 1){
        ellipse(width/2 - faceWidth/2, height/2 - faceHeight/4, earsize*4/5, earsize);
        ellipse(width/2 + faceWidth/2, height/2 - faceHeight/4, earsize*4/5, earsize);
    }
    if(eart == 2){
        rect(width/2 - faceWidth/2, height/2 - faceHeight/4, earsize/2, earsize, earround);
        rect(width/2 + faceWidth/2, height/2 - faceHeight/4, earsize/2, earsize, earround);
    }
    if(eart == 3){
        triangle(width/2 - faceWidth/4, height/2 - faceHeight/5, width/2, height/2 - faceHeight/3, width/2 - faceWidth/3, height/2 - faceHeight/2 - earsize/2);
        triangle(width/2 + faceWidth/4, height/2 - faceHeight/5, width/2, height/2 - faceHeight/3, width/2 + faceWidth/3, height/2 - faceHeight/2 - earsize/2);
    }
    
    
    //tyes of faces
    strokeWeight(6);
    if(facet == 1){
        ellipse(width/2, height/2, faceWidth, faceHeight);
    }
    if(facet == 2){
        rect(width/2, height/2, faceWidth, faceHeight, faceround);
    }
    if(facet == 3){
        triangle(width/2 - faceWidth/2, height/2 - faceHeight/2,
		 width/2 + faceWidth/2, height/2 - faceHeight/2,
		 width/2, height/2 + faceHeight/2);
    }
    
    
    //eyes
    noStroke();
    
    //the white? part of the eye???
    fill(facer + 100, faceb + 100, faceg + 100)
    ellipse(width/2 - width/16, height/2 - height/40, eyesize*2, eyesize*2);
    ellipse(width/2 + width/16, height/2 - height/40, eyesize*2, eyesize*2);
    
    //eyeballs??
    fill(0);
    noStroke();
    var eyeballrX = constrain(mouseX, width/2 - width/16 - eyesize/3, width/2 - width/16 + eyesize/3);
    var eyeballlX = constrain(mouseX, width/2 + width/16 - eyesize/3, width/2 + width/16 + eyesize/3);
    var eyebally = constrain(mouseY, height/2 - height/40 - eyesize/3, height/2 - height/40 + eyesize/3);
    
    ellipse(eyeballrX, eyebally, eyesize, eyesize);
    ellipse(eyeballlX, eyebally, eyesize, eyesize);
    
    //mouth
    fill(facer-100, faceg-150, faceb-150);
    stroke(facer-25,faceg-25,faceb-25);
    ellipse(width/2, height/2 + faceHeight/4, faceWidth/500*mouthsize);
    
    }
 
function mousePressed() {
    faceWidth = random(150,300);
    faceHeight = random(100,350);
    facet = random(types);
    
    earsize = random(80,150);
    mouthsize = random(0,100);
    
    faceround = random(10,20);
    earround = random(5,20);

    eart = random(types);
    facer = random (100,255);
    faceg = random (100,255);
    faceb = random (100,255);
}

manuelr – project2 – face

sketch

//Manuel Rodriguez
//Section B, 10:30am
//manuelr@andrew.cmu.edu
//project-02


var fatFace = 1;
var lankyFace = 1;
var reyeLength = 10;
var leyeLength = 20;
var openM = 40;
var narrowM = 3;
var posX = 1;
var posY = 1;
var c1=230;
var c2 = 100;
var c3 = 200;

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

function draw() {

    //face shadow
    fill(c1,c2,c3);
    noStroke();
    //strokeWeight(2);
    beginShape();
    curveVertex(125,125*lankyFace);
    curveVertex(123,123);
    curveVertex(80*fatFace,height/2+10);
    curveVertex(90,height-110);
    curveVertex(150,height-140);
    curveVertex(190*fatFace,height/2+10);
    curveVertex(120,120);
    curveVertex(125,125);
    endShape();

    //shape face
    noFill();
    stroke(0);
    strokeWeight(1);
    beginShape();
    curveVertex(120,120*lankyFace);
    curveVertex(120,120*lankyFace);
    curveVertex(110*fatFace,height/2);
    curveVertex(130,height-100);
    curveVertex(140,height-150);
    curveVertex(155*fatFace,height/2);
    curveVertex(120,120);
    curveVertex(120,120*lankyFace);
    endShape();

    //shape face 2
    noFill();
    stroke(100);
    strokeWeight(1);
    beginShape();
    curveVertex(125,125*lankyFace);
    curveVertex(123,123);
    curveVertex(105*fatFace,height/2+10);
    curveVertex(135,height-110);
    curveVertex(138,height-140);
    curveVertex(155*fatFace,height/2+10);
    curveVertex(125,125*lankyFace);
    curveVertex(125,125);
    endShape

    //stroke3
    noFill();
    stroke(220);
    strokeWeight(3);
    beginShape();
    curveVertex(100,100);
    curveVertex(130,130);
    curveVertex(105,height/2+40);
    curveVertex(165,height-100);
    curveVertex(178,height-120);
    curveVertex(155,height/2+9);
    curveVertex(140,125);
    curveVertex(125,115);
    endShape();


    //eyes
    noFill();
    //lefteye
    stroke(0);
    strokeWeight(1);
    ellipse(120*posX,height/2*posY,5,leyeLength);

    //rightteye
    stroke(0);
    strokeWeight(1);
    ellipse(135*posX,height/2*posY,5,reyeLength);

    //eyebags
    stroke(0);
    strokeWeight(1);
    line(110*posX,((height/2)+20)*posY, 115*posX, ((height/2)+20)*posY);
    line(135*posX,((height/2)+10)*posY, 145*posX, ((height/2)+10)*posY);


    //mouth
    stroke(0);
    strokeWeight(1);
    ellipse(127*posX,height/2*posY+70,narrowM,openM);
}

function mousePressed(){
    fatFace = random(-1.2,1.5);
    lankyFace = random(-1.2,1.8);
    c1=random(100,250);
    reyeLength = random(0,100);
    leyeLength = random(0,60);
    openM = random(0,40);
    narrowM = random(0,20);
    posX = random(1.0,1.01);
    posY = random(1.0,1.01);
    c2 = random(100,200);
    c3 = random(100,200);
    clear();
 

}

I wanted to create a different type of face, some sort of simple – abstract art that reminds of a face but don’t respond to any proportions nor reality. Just departing from “hand-drawing” style, I started drawing different line shapes and then added the colour independent from the outlines. Each outline has its own independency and they do not relate to other face features such as eyes, mouth or eye-bags.

NatalieKS-Project-02-Variable-Face

sketch

//Natalie Schmidt
//nkschmid@andrew.cmu.edu
//Section D
//Project-02

function setup() {
    createCanvas(640, 480);
    background(126, 204, 213);
    angleMode(DEGREES);
    noStroke();
}

//variables for the color of the fish
var r = 222
var g = 157
var b = 207
//variables for tail and eye size
var tail1 = 60
var tail2 = 130
var eyeB = 20 //for black part of eye
var eyeW1 = 8 //for large white part of eye
var eyeW2 = 5 //for small white part of eye


function draw() {
    fill(170, 220, 234);
//bubbles
    ellipse(480, 20, 40, 40);
    ellipse(450, 100, 50, 50);
    ellipse(480, 165, 30, 30);
    ellipse(440, 200, 10, 10);
//fish body
    fill(r, g ,b);
    ellipse(width/2, height/2, 160, 120);
//fish black eye
    fill(0);
    ellipse(380, 240, eyeB, eyeB);
//fish white eye
    fill(255);
    ellipse(377, 235, eyeW1, eyeW1); // large
    ellipse(385, 245, eyeW2, eyeW2); //small
//mouth
    fill(r, g, b);
    ellipse(403, 238, 12, 12); //top
    ellipse(403, 249, 12, 12); //bottom
//fish tails
    rotate(-45);
    translate(-210, -40);
    ellipse(width/3, 320, tail1, tail2); //top
    rotate(90);
    translate(170, -400);
    ellipse(width/3, 250, tail1, tail2); //bottom
}

function mousePressed() {
//when the mouse is pressed, the color changes
    r = random(0, 255);
    g = random(0, 255);
    b = random(0, 255);
//when mouse is pressed, tail and eye size changes
    tail1 = random(35, 125);
    tail2 = random(90, 175);
    eyeB = random(10, 35);
    eyeW1 = random(3, 20);
    eyeW2 = random(1, 15);
    clear();
    background(126, 204, 213);
}

sketch

For this project, the first thing that came to mind was a fish. I knew I wanted the color, eyes, and tail size to change, but the difficult part was getting the right proportions and the right angles. The initial shapes were pretty simple, because I figured experimenting with curves and rotate at the same time would be a little too complicated for me right now. I didn’t do any initial sketches, since the fish was only going to be a couple of ellipses. The image of the fish kept overlapping each other instead of replacing when I clicked my mouse, so I had to use the clear function to fix the problem; however, after THAT a chunk of the background was getting cleared too, so I filled in the background again at the very end to make it the way I wanted it to appear. I’m not sure if there was any other (better?) way to fix that problem, but this way seemed to work. All in all, I’m pretty proud of the final product!

ctv-Project-02-someFaces

ctv-project-02

//Ty Van de Zande
//Section B @ 10:30 AM
//ctv@andrew.cmu.edu
//Project-02



//document variables
var ht = 480;
var wd = 640;
var cenY = ht / 2;
var cenX = wd / 2;



//setting up the document
function setup() {
    createCanvas(wd, ht);
    frameRate(1);
}


function draw() {
background(230);    
    
var r = random(400);

//variables for heads
var headW = random(r);
var headH = random(r);

//variables for eyes
var eyePosX = random(headW);
var eyePosY = random(headH);
var eyeSize = random(50);

//variables for brows
var bPosX = random(r);
var bPosY = random(200);
var bTop = bPosY + random(r);
var bLength = random(r);
var bRot = random(r);

//mouth
var mX = random(r);
var mY = random(r);
var mTop = random(r);
var mBottom = random(r);
    
    ellipseMode(CENTER);
    rectMode(CENTER);
    fill(255);
    noStroke();
    
    //draws head
    ellipse(cenX, cenY, headW, headH);
    
    
    //daws eyes
    fill(100)
    noStroke();
    ellipse(cenX - eyePosX, cenY , eyeSize, eyeSize);
    ellipse(cenX + eyePosX, cenY , eyeSize, eyeSize);
    
    
    //draws mouth
    strokeWeight(5);
    stroke(120,0,0);
    beginShape();
    vertex(cenX-mX, cenY+mY);
    bezierVertex(cenX, cenY-mTop, cenX, cenY-mTop, cenX+mX, cenY+mY );
    bezierVertex(cenX+mX, cenY+mY, cenX, cenY-mBottom, cenX-mX, cenY+mY);
    endShape();
    
    
    //draws eyebrows
    
    p1 = {x: cenX-bLength, y: cenY - bPosY}, 
    p2 = {x: cenX-(bLength/2), y: cenY - bTop}, 
    p3 = {x: cenX, y:cenY - bPosY}
    
    p4 = {x: cenX+bLength, y: cenY - bPosY}, 
    p5 = {x: cenX+(bLength/2), y: cenY - bTop}, 
    p6 = {x: cenX, y:cenY - bPosY}
    
    noFill();
    strokeWeight(2);
    stroke(255, 150, 0);
    curve(p1.x, p1.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y);
    curve(p4.x, p4.y, p4.x, p4.y, p5.x, p5.y, p6.x, p6.y);
    

}

For someFaces, I structured each component to act on the center point of the canvas. (Is there a better way to use the center point as a shape starting point?) A random number generator is included in the draw() function, and all of the components generate randos with that local rando as the ceiling. The eyes and head (or sometimes nose) always stays on the centerline of the y-axis. The frameRate() is set to 1 so the image refreshes to show a new face! the eyebrows are pretty crazy.