Category: Assignment-04-Face

Face Morph

FaceMorph

/* Image credits:
* Northern White-faced Owl.jpg, frank wouters
** http://commons.wikimedia.org/wiki/File:Northern_White-faced_Owl.jpg

* A-10 Thunderbolt II Shark Face.JPEG, Lee Schading
** http://commons.wikimedia.org/wiki/File:A-10_Thunderbolt_II_Shark_Face.JPEG

* 1977.05.03 Fijian Monkey-faced Bat ,Taveuni, Fiji 3443 ccccr.jpg, William N. Beckon
** http://commons.wikimedia.org/wiki/File:1977.05.03_Fijian_Monkey-faced_Bat_,Taveuni,_Fiji_3443_ccccr.jpg

* CanaanDogFace.jpg, Arikk
** http://commons.wikimedia.org/wiki/File:CanaanDogFace.jpg

* Cat face day.jpg, Abelard
** http://commons.wikimedia.org/wiki/File:Cat_face_day.jpg

* Colletes-thysanellae,-female,-face 2012-04-02-13.14.01-ZS-PMax (7725303126).jpg, 
** USGS Native Bee Inventory and Monitoring Laboratory
*** http://commons.wikimedia.org/wiki/File:Colletes-thysanellae,-female,-face_2012-04-02-13.14.01-ZS-PMax_(7725303126).jpg

All images used with permission from Wikimedia Commons. */

/* --- PRE SETUP --- */
//set all image variables
var owl; var owla; var owlSlider;
var dog; var doga; var dogSlider;
var cat; var cata; var catSlider;
var bee; var beea; var beeSlider;
var bat; var bata; var batSlider;
var a10; var a10a; var a10Slider;

//load all images
function preload() {
  owl = loadImage("http://i.imgur.com/8iKi0Y3.png");
  dog = loadImage("http://i.imgur.com/PEARSch.png");
  cat = loadImage("http://i.imgur.com/bwhJmZh.png"); 
  bee = loadImage("http://i.imgur.com/Xc5EO1E.png");
  bat = loadImage("http://i.imgur.com/nWlIpBW.png");
  a10 = loadImage("http://i.imgur.com/NJjbqb3.png");
}

/* ----- SETUP ----- */
function setup() {
  //create canvas
  createCanvas(420,420); createDiv("");
  //create sliders
  owlSlider = createSlider(0,100,99); createSpan("owl"); createDiv("");
  dogSlider = createSlider(0,100,1); createSpan("dog"); createDiv("");
  catSlider = createSlider(0,100,50); createSpan("cat"); createDiv("");
  beeSlider = createSlider(0,100,1); createSpan("bee"); createDiv("");
  batSlider = createSlider(0,100,50); createSpan("bat"); createDiv("");
  a10Slider = createSlider(0,100,1); createSpan("a10"); createDiv("");
}

/* --- MAIN LOOP --- */
function draw() {
  //clear the canvas
  background(128);  
  
  //update the alpha values.
  owla = owlSlider.value();
  doga = dogSlider.value();
  cata = catSlider.value();
  beea = beeSlider.value();
  bata = batSlider.value();
  a10a = a10Slider.value();
  
  //draw each of the faces with respective alpha value.
  drawImage(owl,owla);
  drawImage(dog,doga);
  drawImage(cat,cata);
  drawImage(bee,beea);
  drawImage(bat,bata);
  drawImage(a10,a10a);
}

function drawImage(img,imga) {
  tint(255,imga*2.55);
  image(img,0,0);
}




Neon Easter

Screen Shot 2014-09-22 at 18.05.36

Rapidly vibrating easter island faces. This starts as a static image of the above face, but clicking causes the colour of the bars to change and for each bar to be assigned a variable amount of wobble.

NeonEaster2

class Bar{ //class for each of the neon bars that for the fave
  color c;
  int sX;
  int sY;
  int eX;
  int eY;
  float var;
 
  Bar(color tempC,int tempSx, int tempSy, int tempEx, int tempEy){
    c = tempC;
    sX = tempSx;
    sY = tempSy;
    eX = tempEx;
    eY = tempEy;
    var = 0.0;
  }
  void update(){
 
  }
  // randomly moves the bar based on the amount of chosen variance,
  // then draws the line
  void display(){ 
    int tsx = sX + int(random(-var, var));
    int tsy = sY + int(random(-var, var));
    int tex = eX + int(random(-var, var));
    int tey = eY + int(random(-var, var));
    strokeWeight(1);
    stroke(c);
    line(tsx, tsy, tex, tey);
    strokeWeight(4); //second low-alpha line imitates a glow
    stroke(c,100);
    line(tsx, tsy, tex, tey);
  }
  //feeds a new colour and movement cariance from a mouse click
  void updateCol(color newC, float newVar){
     c = newC; 
     var = newVar;
  }
}
 
//these are the 2 sets of bars that equate to 2 light sources
ArrayList<Bar> hiBars; 
ArrayList<Bar> loBars;
 
void setup(){
  size(600,800);
  hiBars = new ArrayList<Bar>();
  loBars = new ArrayList<Bar>();
  color cLo = color(255,0,0);
  color cHi = color(250,250,250);
 
  // adding the bars themselves
  loBars.add(new Bar(cLo, 150,200, 275,200));
  loBars.add(new Bar(cLo, 325,200, 450,200));
  loBars.add(new Bar(cLo, 240,450, 360,450));  
 
  hiBars.add(new Bar(cHi, 310,245, 335,370));
  hiBars.add(new Bar(cHi, 260,490, 340,490)); 
  hiBars.add(new Bar(cHi, 220,220, 220,235)); 
  hiBars.add(new Bar(cHi, 390,220, 390,235));
}
 
void draw(){
  background(30);
  Bar bar;
  for (int i = hiBars.size()-1; i >= 0; i--) {
    bar = hiBars.get(i);
    bar.update();
    bar.display();
  }
  for (int i = loBars.size()-1; i >= 0; i--) {
    bar = loBars.get(i);
    bar.update();
    bar.display();
  }
}
 
//returns a clolour with net brightness (r+g+b) higher than cs
color brighter(color c){
  float r = red(c);
  float g = green(c);
  float b = blue(c);
  //rgb values are cycled to give color variance
  return color(random(g,255),random(r,255),random(b,255));
}
 
// creates new color choices and shake variance on click
void mousePressed(){
  color newLo = color(random(255),random(255),random(255));
  color newHi = brighter(newLo);
  int var = 10;
  Bar bar;
  for (int i = hiBars.size()-1; i >= 0; i--) {
    bar = hiBars.get(i);
    bar.updateCol(newLo, random(var));
  }
  for (int i = loBars.size()-1; i >= 0; i--) {
    bar = loBars.get(i);
    bar.updateCol(newHi, random(var));
  }
 
 
}

 

Assignment 4: Chaos/Order/Faces Experiments

My Chaos vs. Order and Face projects kind of merged together in terms of what ideas they explore, so I’ve combined them into one blog post here…

I decided to research chaos and faces through visual distortion and face detection algorithms. I was inspired greatly by this blog post about “machine pareidolia”.

For the Chaos/Order project, I took an image of a human face and slowly distorted it until it was not recognizable by a face detection algorithm. Each step of the program increments a chaos constant which controls the amount of distortion that is passed into a shader that uses a perlin noise texture to transform the texture coordinates of a quad textured with the face image. Here are the results:

The face was obviously detected at step 0, where chaos=0…

0

At step 30, the face begins to look slightly “off”, but is still recognized.

30

Step 57 is still considered a face…

57

The face stays a face until step 162.

162

It’s interesting to see that step 161, the previous step, is only so slightly different enough from step 162 that it is still a machine-readable face!

161

On a similar note, my Generative Face project was about finding more faces from distorted faces (meta pareidolia?). I started with a basic geometric machine-recognisable face and incremented a similar chaos variable. Here are the results (detected faces are highlighted by squares):

Chaos = 5

chaos5

Chaos = 10

chaos10

Chaos = 50

chaos50

Active KKK groups in the United States

USKKKMAP1 For this assignment, I wanted my face to be used for data visualization. Initially, I was thinking I could change the characteristics of the figure to illustrate certain statistics like the example shown to us in class. However, when I tried to implement this technique in the design, the results weren’t very effective.

Instead I decided to use my face as a graphic to create a visualization of today’s active KKK groups in the United States.

 

 

//WT
//Chernoff faces

void setup(){
size(500,500);
PImage img = loadImage("confederate.jpg");
 
}
 
void draw(){
PImage img = loadImage("confederate.jpg");
float cx = width/2; float cy = height/2 + 20;
float eyeWidth = 5;
float eyeHeight = 3;
float bot = cy + 100;
float top = cy - 50;
float skullX0 = cx - 50;
float skullX1 = cx + 50;
float skullY = cy - 20;
float jawX0 = cx - 70;
float jawX1 = cx + 70;
float jawY = cy + 30;
 
if (mousePressed){
background(100);
image(img, 140,200);
strokeWeight(2);
//Body
ellipse(cx, height+20, random(300,400),random(150,200));
eyeWidth = random(25,30);
eyeHeight = random(35,50);
bot = cy + random(200,240);
top = cy - random(100, 150);
skullX0 = cx - random(width/6, width/10);
skullX1 = cx + random(width/5, width/8);
skullY = cy + random(width/2, width/5);
jawX0 = cx - random(width/6, width/10);
jawX1 = cx + random(width/6, width/10);
jawY = cy + random(width/3,width/5);
//hat
bezier(cx, top, skullX0,skullY,jawX0, jawY,cx,bot);
bezier(cx, bot, jawX1, jawY, skullX1, skullY, cx, top);
strokeWeight(random(18,25));
//EYES
point(cx + eyeWidth, cy + 2*eyeHeight);
point(cx - eyeWidth, cy + 2*eyeHeight);
}
}

 

Something Cute I Hope

Mouse position changes facial structure, arms follow mouse position and when clicked, color changes. It laughs if it is “tickled” by the mouse.
Something Cute I Hope

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
int skinColorR = 100;
int skinColorG = 200;
int skinColorB = 300;
 
void setup() {
  size(600, 600);
}
 
void draw() {
  background(#ffffff);
  smooth();
 
  float randxymin = 85;
  float randxymax = 130;
 
  float randXL = map(mouseX, 0, width, randxymin, randxymax);
  randXL = constrain(randXL, randxymin, randxymax); 
  float randXR = map(width-mouseX, 0, width, randxymin, randxymax);
  randXR = constrain(randXR, randxymin, randxymax); 
  float randYT = map(mouseY, 0, height, randxymin, randxymax);
  randYT = constrain(randYT, randxymin, randxymax);
  float randYB = map(height-mouseY, 0, height, randxymin, randxymax);
  randYB = constrain(randYT, randxymin, randxymax);
 
  float randXS = map(mouseX, 0, width, 10, 40);
  randXS = constrain(randXS, 10, 40); 
  float randYS = map(mouseY, 0, height, 10, 40);
  randYS = constrain(randYS, 10, 40); 
 
  //define features
  float eyeSize = (randXS+randYS)/2; 
  float faceWidth = randXL; 
  float faceHeight = randYT;
 
 
  //draw features
  strokeWeight(1);
  fill(skinColorR, skinColorG, skinColorB);
  ellipse (width/2, height/2, faceWidth, faceHeight); 
  filter(BLUR, 3);
  float eyeLX = width/2 - faceWidth*0.15;
  float eyeRX = width/2 + faceWidth*0.15;
  fill(#ffffff);
  if ((mouseX&gt;=((width/2)-(faceWidth/2))) &amp;&amp; (mouseX&lt; =((width/2)+(faceWidth/2))) 
  &amp;&amp; (mouseY&gt;=((height/2)-(faceHeight/2))) &amp;&amp; (mouseY&lt; =((height/2)+(faceHeight/2)))) {
    noFill(); 
  strokeWeight(2);
  arc(eyeLX, height/2-faceHeight*0.1, 20, 10, PI, TWO_PI);
  arc(eyeRX, height/2-faceHeight*0.1, 20, 10, PI, TWO_PI);
  } else {
    ellipse (eyeLX, height/2-faceHeight*0.1, 20, eyeSize); 
    ellipse (eyeRX, height/2-faceHeight*0.1, 20, eyeSize);
    fill(0, 0, 0);
    ellipse (eyeLX, height/2-faceHeight*0.1, 8, 8); 
    ellipse (eyeRX, height/2-faceHeight*0.1, 8, 8); 
  }
  strokeWeight(1);
    fill(0, 0, 0);
  if ((mouseX&gt;=((width/2)-(faceWidth/2))) &amp;&amp; (mouseX&lt; =((width/2)+(faceWidth/2)))) {
    if ((mouseY&gt;=((height/2)-(faceHeight/2))) &amp;&amp; (mouseY&lt; =((height/2)+(faceHeight/2)))) {
      float mouthHeight = random(10, 30);
      arc(width/2, height/2+faceHeight*0.1, 30, mouthHeight, 0, PI, PIE);
    }
  }
    float MXS = map(mouseX, 0, width, -100, 100);
  MXS = constrain(MXS, -100, 100); 
 float MYS = map(mouseY, 0, height, -100, 100);
  MYS = constrain(MYS, -100, 100); 
 
    float space1 = random(-3,3);
    float space2 = random(-3,3);
 
    float armLength = 40;
    float LarmStartX = width/2-faceWidth*0.38;
    float LarmStartY = height/2+faceHeight*0.05;
   float LarmMidInsideX = (width/2)-70+MXS*.5+space2/3;
   float LarmMidInsideY = (height/2)+50+MYS+space1/3;
   float LarmMidOutsideX = LarmMidInsideX+(MXS);
   LarmMidOutsideX = constrain(LarmMidOutsideX,LarmStartX-armLength*.8,LarmStartX+armLength*.8);
   float LarmMidOutsideY = LarmMidInsideY+(MYS);
      LarmMidOutsideY = constrain(LarmMidOutsideY,LarmStartY-armLength*.8,LarmStartY+armLength*.8);
   float LarmEndX = mouseX-10;
   LarmEndX = constrain(LarmEndX,LarmStartX-armLength,LarmStartX+armLength)+space1;
   float LarmEndY = mouseY-10;
   LarmEndY = constrain(LarmEndY,LarmStartY-armLength,LarmStartY+armLength)+space2;
 
 
   float RarmStartX = width/2+faceWidth*0.38;
    float RarmStartY = height/2+faceHeight*0.05;
   float RarmMidInsideX = (width/2)+70+MXS*.5+space2/3;
   float RarmMidInsideY = (height/2)+50+MYS+space1/3;
   float RarmMidOutsideX = RarmMidInsideX+(MXS*.5);
   RarmMidOutsideX = constrain(RarmMidOutsideX,RarmStartX-armLength*.8,RarmStartX+armLength*.8);
   float RarmMidOutsideY = RarmMidInsideY+(MYS*.5);
   RarmMidOutsideY = constrain(RarmMidOutsideY,RarmStartY-armLength*.8,RarmStartY+armLength*.8);   
   float RarmEndX = mouseX+10;
   RarmEndX = constrain(RarmEndX,RarmStartX-armLength,RarmStartX+armLength)+space2;
   float RarmEndY = mouseY-10;
   RarmEndY = constrain(RarmEndY,RarmStartY-armLength,RarmStartY+armLength)+space1;
 
  noFill();
  stroke(0);
  strokeWeight(3);
  bezier(LarmStartX, LarmStartY, 
  LarmMidInsideX, LarmMidInsideY,//height/2+faceHeight*0.8, 
  LarmMidOutsideX, LarmMidOutsideY, LarmEndX, LarmEndY);
  bezier(RarmStartX, RarmStartY, 
  RarmMidInsideX, RarmMidInsideY,//height/2+faceHeight*0.8, 
  RarmMidOutsideX, RarmMidOutsideY, RarmEndX, RarmEndY);
}
 
void mousePressed() {
  skinColorR = int(random (0, 255));
  skinColorG = int(random (0, 255));
  skinColorB = int(random (0, 255));
}

Little Boy

little boyfin
Gif of piece

 

 

Little Boy screenshot Little Boy
I imagine this program to be an overbearing aunt pulling the cheek of a little boy and the faces he makes at the incredibly uncomfortable situation. I linked the top of his hat to his actual face so it would stretch along with his cheeks and constrained the pupils in the eyes by creating an if statement that would resize them if the random generator ever attempted to make them greater than the size of the whites. I allowed for them to be equal however. I did a similar function for the blush, also randomizing the shade of the alpha.

EDITED: I added a moving gif of the project

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
float m1= 50;//whites of eyes
float resize=150;//adding to face shape
float mou= 55;//mouth 
float fshape=450;
float leftfa=100;//changing the width of left side of face
float rightfa=500;//changing width of right side of face
 
float leftcap=leftfa;
float rightcap=rightfa;//making sure when clicked the right side of cap is connected to the right side of face
 
 
float bball=25;//pupil
//creating shape group
float blush=25;//blush size
float shadeblush=93;//shade of pink of blush
float visblush=0;//alpha value of blush
float blushheight=190;
 
 
void setup(){
size(600,600);
 
}
 
void draw(){
  translate(0, 100);
background(108,155,224);
 
//drawing face
beginShape();
fill(165,68,10);
stroke(3);
curveVertex(resize,100);
curveVertex(leftfa,100);
 
curveVertex(resize,300);
curveVertex(fshape,300);
 
 
curveVertex(rightfa,100);
curveVertex(450,100);
endShape(CLOSE);
 
 
   // drawing cap cap
 
beginShape();
fill(0,0,255);
stroke(10);
 
curveVertex(150,300);
curveVertex(leftcap,100);
 
curveVertex(300,25);
 
curveVertex(rightcap,100);
curveVertex(450,300);
 
endShape(CLOSE); 
 
  //top of cap
 
 
beginShape();//inside cap skin
fill(165,68,10);
stroke(10);
 
curveVertex(250,100);
curveVertex(250,80);
 
curveVertex(300,55);
 
curveVertex(350,80);
curveVertex(350,100);
 
endShape(CLOSE); 
 
//eye1 
fill(255,255,255);
ellipse(375,150,m1,m1);
//eye2
ellipse(200,150,m1,m1);
 
  fill(0,0,0);
 //eyeball1
ellipse(375,150,25,bball);
 
 //eyeball2
ellipse(200,150,25,bball);
 
//mouth
rect(255, 200,mou,m1);
 
//blush
 
noStroke();
fill(210,shadeblush,151,visblush);
ellipse(200,blushheight,75,blush);
ellipse(400,blushheight,75,blush);
 
}
 
 
 
 void mousePressed(){
m1= random(100);
 
mou= random(100);
bball= random(25,75);
if (bball>=m1){//making sure the pupils is less then or equal to the size of the eye
  bball=25;
}
 
if (m1==50){//making sure the blush isn't ontop of pupil
  blushheight= 200;
 
}if (m1>=50){
  blushheight=225;}
  else{
  blushheight=190;
}
 
resize= random(150,200);
leftfa= random(100);//changing width position of left side of face
rightfa= random(500,600);
 
leftcap= leftfa;
rightcap= rightfa;
shadeblush= random(129);
visblush= random(0,129);
 
}

It’s not Matt

mbk-variableface

/////////////////////
// not my face
// Author: Matthew Kellogg
// September 22, 2014
/////////////////////
var eyeRandom, noseRandom, randomBadHair, randomWidowsPeak;
var mouthRandom = {};

function setup(){
  // put setup code here
  createCanvas(400,600);
  mousePressed();
}

function mousePressed(){
  eyeRandom = random(-60, 20);
  noseRandom = random(0,45);
  randomBadHair = random(0,100);
  randomWidowsPeak = random(0,30);
  mouthRandom[0] = random(-10,10);
  mouthRandom[1] = random(-10,10);
  mouthRandom[2] = random(-10,10);
  mouthRandom[3] = random(-10,10);
}

function draw() {
  //simple red background
  background(140, 20, 20);
  //set colors
  var skinColor  = color(206, 179, 113);
  var skinShadowColor = color(147, 109, 72);
  
  fill(skinColor);
  stroke(skinShadowColor);
  strokeWeight(4);
  ellipse(196,267, 253, 298);
  
  //draw eyes
  drawEye(1, 226, 274+eyeRandom);
  drawEye(-1, 179, 274+eyeRandom);
  
  //draw nose
  fill(skinColor);
  stroke(skinShadowColor);
  strokeWeight(4);
  beginShape();
  curveVertex(284,227);
  curveVertex(207,258);
  curveVertex(215+noseRandom,322);
  curveVertex(188,325);
  curveVertex(272,309);
  endShape(OPEN);
  
  //draw hair
  var hairColor = color(104, 70, 32);
  var hairOutline = color(57, 38, 17);
  stroke(hairOutline);
  fill(hairColor);
  beginShape();
  vertex(64,250);
  vertex(85,153);
  vertex(110,123);
  vertex(190,106);
  vertex(193+randomBadHair,105-randomBadHair/2);
  vertex(196,106);
  vertex(289,125);
  vertex(310,153);
  vertex(331,251);
  vertex(306,265);
  vertex(269,177);
  vertex(256,183);
  vertex(226,181);
  vertex(200,180+randomWidowsPeak);
  vertex(171,186);
  vertex(132,186);
  vertex(88,249);
  endShape(CLOSE);
  
  stroke(158,117,74);
  strokeWeight(3);
  //randomize mouth position
  line(191+mouthRandom[0],357+mouthRandom[1],230+mouthRandom[2],348+mouthRandom[3]);
}

function drawEye(d, eyeX, eyeY)
{
  strokeWeight(8);
  stroke(104, 70, 32);
  noFill();
  beginShape();
  vertex(eyeX+d*-3, eyeY-25);
  vertex(eyeX+d*36,eyeY-34);
  vertex(eyeX+d*57,eyeY-30);
  endShape(OPEN);
  
  fill(229,226,245);
  stroke(109,90,66);
  strokeWeight(2);
  beginShape();
  vertex(eyeX + d*0,eyeY + 0);
  vertex(eyeX + d*16,eyeY + -10);
  vertex(eyeX + d*33,eyeY + -10);
  vertex(eyeX + d*46,eyeY + -5);
  vertex(eyeX + d*32,eyeY + 5);
  vertex(eyeX + d*20,eyeY + 6);
  endShape(CLOSE);
  
  fill(74,74,198);
  noStroke();
  ellipse(eyeX+(25*d), eyeY + -1, 14, 13);
  fill(0,0,0);
  ellipse(eyeX+(25*d), eyeY + -1, 4, 4);
}

At first I was attempting to draw variable cat faces that could go from kittens to lions, but after spending a tremendous amount of time realizing that the curves in p5js aren’t filled right, I went back to attempt a simpler project with the time I had remaining. The variable features of this project are the eye position, nose size, mouth smirking, and the widows peak and messiness of the hair.

Parametric Faces

I really butchered any sort of expressiveness that a face should be capable of. My sketch creates faces with a variable amount of eyes, situated around an eternally apathetic mouth of variable width. These two factors are randomized using the Perlin noise function provided by Processing. To show the contrast between noise and pure randomness, I made the size of the faces vary completely randomly.

sketch (1)

function setup() {
  createCanvas(800,600);
  background(255,0,0);
}

function draw() {
  background(255,0,0);
  for(var row = 0; row < 21; row ++){
    for(var col = 0; col < 16; col++){
      face(30*row, 30*col, 23+random(2), 23+random(2), ceil(10 * noise(frameCount*0.04,row*0.02,col*0.02)), ceil(20*noise(10000+frameCount*0.08,row,col)));
    }
  }
}
function face(x, y, w, h, e, mw){
  var pos, fHeight, fWidth, eyeCount, mouthWidth, eyeCenter, eyeDistance;
  noStroke();
  fHeight = h;
  fWidth = w;
  eyeDistance = min(fWidth, fHeight)*1/3;
  eyeCount = e;
  mouthWidth = mw;
  pos = createVector(x,y);
  push();
  translate(pos.x,pos.y);
  fill(255);
  ellipse(0,0,fWidth,fHeight); //make head
  fill(0);
  for(var eyes = 0; eyes < eyeCount; eyes++){
    var eyeX = eyeDistance * cos(eyes*TWO_PI/eyeCount);
    var eyeY = eyeDistance * sin(eyes*TWO_PI/eyeCount);
    fill(0);
    ellipse(eyeX, eyeY, min(fHeight,fWidth)/(eyeCount),min(fHeight,fWidth)/(eyeCount));
  }
  stroke(0);
  strokeWeight(1);
  line(mouthWidth/2, 0,-mouthWidth/2, 0);
  noStroke();
  pop();
}

Assignment-04 Face- IKA

plant face

I initially wanted to randomize the plant as well, but I became confused in terms of the curveVertex function. I also wanted the face to be a more irregular shape, possibly stroked with a hand-drawn feeling to it. The curveVertex function frustrates me. Despite how basic this is, I’m awful at code and even this took longer than needed.

float nose1Size= 280;
float nose2Size= 290;
float nose3Size= 300;
float eyesize= 15;
float eyeballs= 10;
float eyebrowWidth= 8;
float facewidth= 200;
float faceheight= 230;
 
void setup (){
  size (600,600);
 
}
 
void draw (){
   background (193, 211, 222);
 
 
   // plant coming up from head
 
   stroke (148, 173, 146);
   line (300, 450, 300, 100);
 
   fill (148, 173, 146);
   beginShape();
   curveVertex (300, 285);
   curveVertex (330, 270);
   curveVertex (310, 260);
   curveVertex (300, 285);
   endShape ();
 
   beginShape();
   curveVertex (300, 230);
   curveVertex (270, 240);
   curveVertex (240, 256);
   curveVertex (300, 230);
   endShape ();
 
   beginShape ();
   curveVertex (300, 200);
   curveVertex (330, 190);
   curveVertex (310, 182);
   curveVertex (300, 200);
   endShape ();
 
   beginShape ();
   curveVertex (300, 120);
   curveVertex (320, 100);
   curveVertex (310, 98);
   curveVertex (300, 120);
   endShape ();
 
   beginShape ();
   curveVertex (300, 120);
   curveVertex (290, 95);
   curveVertex (282, 90);
   curveVertex (300, 120);
   endShape ();
 
   // done with plant
 
   // face
   fill (250, 245, 232);
   noStroke ();
   ellipse (300,400, facewidth, faceheight);
 
 
   // eyes
   noStroke ();
   fill (180);
   arc  (260, 480, eyesize, eyesize, 0, PI+QUARTER_PI, OPEN);
   arc  (330, 480, eyesize, eyesize, 0, PI+QUARTER_PI, OPEN);
 
   //eyeballs
 
   fill (210);
   ellipse (260, 480, eyeballs, eyeballs);
   ellipse (330, 480, eyeballs, eyeballs);
 
   //nose
 
   fill(204, 186, 186);
   triangle (nose1Size, 530, nose2Size, 510, nose3Size, 520);
 
   //eyebrows
 
   fill (210);
   rect (245, 460, 30, eyebrowWidth);
   rect (310, 460, 30, eyebrowWidth);
 
 
}
 
void mousePressed (){
  facewidth = random (170, 290);
  faceheight = random (200, 320);
  nose1Size = random (230, 290);
  nose2Size = random (260, 310);
  nose3Size = random (270, 330);
  eyebrowWidth = random (1, 10);
  eyesize = random (10, 20);
  eyeballs = random (5, 15);
}

emoticon face generator

For whatever reason I had a lot of trouble getting this to do things that actually looked interesting and good when I started randomizing them so I ended up settling for something really simple, even though I’m not very happy about it.

emotegenerator

I ended up spending so long trying to get the face to actually look skin-colored most of the time (which, as you can see, tanked miserably), and ran out of time to properly address the other things I wanted to add, like hair. And noses. And other necessary facial features, y’know. But at least it makes half-hearted reaction images?

 

//electronic media studio: interactivity
 
//variable list
float faceradius = 200;
float faceR = 232;
float faceG = 150; 
float faceB = 150;
float rEye = 50;
float gEye = 75;
float bEye = 225;
float eyeSize = 40;
float vertA1 =100;
float vertA2 =100;
float vertB1= 120;
float vertB2C2 =200;
float vertC1 = 180;
float vertD1 = 200;
float vertD2 = 100;
 
void setup(){
  size(300,300);
}
 
void draw(){
  background(146,237,224);
  strokeWeight(1);
  fill(faceR, faceG, faceB);
  ellipse (width/2, height/2, faceradius, faceradius);
 
  float eyeLX = width/2 - faceradius*0.3;
  float eyeRX = width/2 + faceradius*0.3;
   fill(rEye,gEye,bEye);
   ellipse (eyeLX, height/2, eyeSize, eyeSize); 
   ellipse (eyeRX, height/2, eyeSize, eyeSize);
 
   strokeWeight (5);
   noFill();
   curve(vertA1,vertA2, vertB1,vertB2C2, vertC1,vertB2C2, vertD1,vertD2);
}
 
void mousePressed(){
  eyeSize    = random (10,  30); 
  faceradius = random (100, 200); 
  rEye = random (150, 255);
  gEye = random (150, 255);
  bEye = random (150, 255);
  faceR = random (165, 210);
  faceG = random (120, 210);
  faceB = random (90, 190);
  vertA1 = random (100,200);
  vertA2 = random (80, 250);
  vertB1 = random (100, 140);
  vertB2C2 = random (150,210);
  vertC1 = random (160, 220);
  vertD1 = random (200,300);
  vertD2 = random (80,250);
 
  if (faceradius&lt;150){
    vertB2C2 = random(150,175);
  }
 
}