Joanne Lee – Project 02

Joanne Lee – Project 02

// Joanne Lee
// Section C
// joannele@andrew.cmu.edu
// Project-02
var eyeType = 1;
var face = 250;
var eyeY = (320+(320-0.15*face))/2;
var brow = 1;
var browY1 = eyeY-0.10*face;
var browY2 = eyeY-0.10*face;
var browStroke = 8;
var stacheR = 255;
var stacheG = 255;
var stacheB = 255;

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

function draw() {
  background (254, 203, 212);
  var rightEyeX = (240+(240+0.3*face))/2;
  var leftEyeX = (240+(240-0.3*face))/2;
  var eyeColor = "rgb(0,0,0)";
  var curveAnchorY = (eyeY+0.05*face)+50;

  // ears
  var rightEarX = 240-0.33*face;
  var leftEarX = 240+0.33*face;
  var earY = 320-0.32*face;
  var earSize = 70;

  strokeWeight(5);
  stroke(0);
  fill(223,155,58);
  //right brow
  ellipse(rightEarX,earY,earSize,earSize);
  //left brow
  ellipse(leftEarX,earY,earSize,earSize);

  // face
  ellipse(240,320,face,0.85*face);

  // eyebrows
  var leftBrowX1 = leftEyeX-0.09*face;
  var leftBrowX2 = leftEyeX+0.07*face;
  var rightBrowX1 = rightEyeX-0.07*face;
  var rightBrowX2 = rightEyeX+0.09*face;

  strokeWeight(browStroke);
  //left brow
  line(leftBrowX1,browY1,leftBrowX2,browY2);
  //right brow
  line(rightBrowX1,browY2,rightBrowX2,browY1);

  // eyes
  strokeWeight(0);
  fill(eyeColor);
  if (eyeType == 1) { // circle eyes
    var eye1Size = 0.06*face;

    // right eye
    ellipse(rightEyeX,eyeY,eye1Size,eye1Size);
    // left eye
    ellipse(leftEyeX,eyeY,eye1Size,eye1Size);
  }
  else if (eyeType == 2) { // oval eyes
    var eye2SizeW = 0.06*face;
    var eye2SizeH = 0.12*face;

    // right eye
    ellipse(rightEyeX,eyeY,eye2SizeW,eye2SizeH);
    // left eye
    ellipse(leftEyeX,eyeY,eye2SizeW,eye2SizeH);
  }
  else if (eyeType == 3) { // laughing eyes
    var leftEyeX1 = leftEyeX-0.04*face;
    var leftEyeX2 = leftEyeX+0.04*face;
    var leftEyeY1 = eyeY-0.03*face;
    var leftEyeY2 = eyeY+0.03*face;
    var rightEyeX1 = rightEyeX+0.04*face;
    var rightEyeX2 = rightEyeX-0.04*face;
    var rightEyeY1 = eyeY-0.03*face;
    var rightEyeY2 = eyeY+0.03*face;

    stroke(eyeColor);
    strokeWeight(8);

    // left eye
    line(leftEyeX1,leftEyeY1,leftEyeX2,eyeY);
    line(leftEyeX2,eyeY,leftEyeX1,leftEyeY2);
    // right eye
    line(rightEyeX1,rightEyeY1,rightEyeX2,eyeY);
    line(rightEyeX2,eyeY,rightEyeX1,rightEyeY2);
  }
  else if (eyeType == 4) { // dead eyes
    var leftEyeX1 = leftEyeX-0.05*face;
    var leftEyeX2 = leftEyeX+0.05*face;
    var leftEyeY1 = eyeY-0.04*face;
    var leftEyeY2 = eyeY+0.04*face;
    var rightEyeX1 = rightEyeX-0.05*face;
    var rightEyeX2 = rightEyeX+0.05*face;
    var rightEyeY1 = eyeY-0.04*face;
    var rightEyeY2 = eyeY+0.04*face;

    stroke(eyeColor);
    strokeWeight(8);

    // left eye
    line(leftEyeX1,leftEyeY1,leftEyeX2,leftEyeY2);
    line(leftEyeX2,leftEyeY1,leftEyeX1,leftEyeY2);
    // right eye
    line(rightEyeX1,rightEyeY1,rightEyeX2,rightEyeY2);
    line(rightEyeX2,rightEyeY1,rightEyeX1,rightEyeY2);

  }

  // nose
  var noseX = 240;
  var noseY = 320+0.05*face;
  var noseSize = 0.1*face;
  ellipse(noseX,noseY,noseSize,noseSize);

  // mustache
  var leftStacheX = noseX-0.07*face;
  var rightStacheX = noseX+0.07*face;
  var stacheY = noseY+0.06*face;
  var stacheSizeW = 1.7*noseSize;
  var stacheSizeH = 1.4*noseSize;

  strokeWeight(0);
  fill(stacheR,stacheG,stacheB);
  //left stache
  ellipse(leftStacheX,stacheY,stacheSizeW,stacheSizeH);
  //right stache
  ellipse(rightStacheX,stacheY,stacheSizeW,stacheSizeH);
}

function mousePressed() {
  face = random(250,400)
  eyeType = int(random(1,5));
  browStroke = random(4,10);
  brow = int(random(1,3));
  if (brow == 1) { // concerned brows
    browY1 = eyeY-0.10*face;
    browY2 = random(250,260);
  }
  else { // angry brows
    browY2 = eyeY-0.10*face;
    browY1 = random(250,260);
  }
  stacheR = random(200,255);
  stacheG = random(100,255);
  stacheB = random(150,255);
}

At first, I planned to do variable faces regarding iPhone emojis. However, I decided to hone in more on my favorite emoji — KakaoTalk’s character, Ryan. My variable starts off as the traditional character’s face and then varies. I was curious if the character would still be noticeable with different features and emotions.

Leave a Reply