Author Archive

Variable Face Generator

randomFace
//Random Face Generator

float facewidth = 150;
float faceheight = 200;
float eyewidth = 20;
float eyeheight = 25;
float mouthwidth = 50;
float mouthheight = 30;
float mouthx = 250;
float mouthy = 285;

void setup(){
size(500,500);
background(#378672);
noStroke();
rectMode(CENTER);
ellipseMode(CENTER);
smooth();
}

void draw(){
//head
fill(211,167,119);
ellipse(width/2,height/2,facewidth,faceheight);
//eyes
fill(0);
ellipse(width/2.3,height/2.2,eyewidth,eyeheight);
fill(0);
ellipse(width/1.8,height/2.2,eyewidth,eyeheight);
//mouth
fill(0);
ellipse(mouthx,mouthy,mouthwidth,mouthheight);
if(mousePressed){
facewidth = random(100,200);
faceheight = random(120,220);
eyewidth = random(8,30);
eyeheight = random(18,43);
mouthwidth = random(20,60);
mouthheight = random(10,40);
mouthx = random(215,270);
mouthy = random(265,300);
background(#378672);
}
}

Coding in the News

http://www.wnyc.org/story/video-gaming-your-way-new-job/

This podcast discusses a new trend of companies implementing video games to replace or augment traditional job interviews.

Self-Portrait

face_robin

//Self-Portrait

void setup()
{
size(1000,1000);
background(144,176,188);
smooth();
noStroke();
}

void draw()
{
float trix = (500 – (298/2));
float triy = (393 + 40);

//neck
fill(250,211,192); //peach
rectMode(CENTER);
rect(width/2, 900, 270, 200);

//left ear
fill(252,187,166); //redder peach
ellipse(300, 630, 50, 150);

//right ear
fill(252, 187, 166); //redder peach
ellipse(700, 630, 50, 150);

//hair
fill(70,35,13); //dark brown
ellipse(width/2, 500, 420, 420);

//head
fill(250,211,192); //peach
ellipse(width/2, 600, 400, 550);

//fringe
fill(70,35,13); //dark brown
rect(width/2, 393, 298, 80);

//fringe top
fill(70,35,13); //dark brown
ellipse(width/2, 370, 200, 100);

//triangle 1
fill(250,211,192); //peach
triangle(trix, triy, trix + 25, triy – 40, trix + 50, triy);

//triangle 2
fill(250,211,192);
triangle(trix+40, triy, trix + 60, triy – 40, trix + 80, triy);

//triangle 3
fill(250,211,192);
triangle(trix+80, triy, trix + 100, triy – 40, trix + 120, triy);

//triangle 4
fill(250,211,192);
triangle(trix+120, triy, trix + 140, triy – 40, trix + 160, triy);

//triangle 5
fill(250,211,192);
triangle(trix+160, triy, trix + 180, triy – 40, trix + 200, triy);

//triangle 6
fill(250,211,192);
triangle(trix+200, triy, trix + 220, triy – 40, trix + 240, triy);

//triangle 7
fill(250,211,192);
triangle(trix+240, triy, trix + 270, triy – 40, trix + 300, triy);

//left eyebrow
fill(52,22,11); //dark brown
quad(320, 540, 340, 520, 460, 520, 480, 540);

//right eyebrow
fill(52,22,11); //dark brown
quad(520, 540, 540, 520, 660, 520, 680, 540);

//left eye
fill(0);
ellipse((320+480)/2 + 12, 560, 19, 26);

//right eye
fill(0);
ellipse((520+680)/2 – 12, 560, 19, 26);

//beard top left
fill(52,22,11);
triangle(300, 555, 405, 710, 300, 710);

//beard top right
fill(52,22,11);
triangle(700, 555, 595, 710, 700, 710);

//beard bottom left
fill(52,22,11);
triangle(300, 710, 405, 710, 405, 865);

//beard bottom right
fill(52,22,11);
triangle(700, 710, 595, 710, 595, 865);

//goatee
fill(52,22,11);
ellipse(width/2, 793, 250, 230);

//mouth
fill(0);
ellipse(width/2, 742, 145, 30);

//left tooth
fill(255,251,237);
rect(width/2 – 12, 739, 22, 19);

//right tooth
fill(255,251,237);
rect(width/2 + 12, 739, 22, 19);

//water
fill(12,103,191);
rect(width/2, 1000, 1000, 130);

//nose
fill(252, 187, 166);
ellipse(width/2, 620, 65, 140);
}

'+
1
'+
2 - 3
4 - 5
6 - 7
8 - 9
10 - 11
12 - 13
13 - 14
[x]