PROCESSING

Random Bird Generator The Guinea Pig Game My Pet Square

void setup (){
size(400, 400);
background (255);
smooth();
noStroke ();
noLoop();
}

void draw ()
{
background (255);

for (int i = 0; i<3; i++)
{
for (int j = 0; j<3; j++)
{
float xcoord = (2*i+1)*66.6;
float ycoord = (2*j+1)*66.6;
float r = random (100, 250);
float g = random (100, 250);
float b = random (100, 250);
float t = random (0, 155);
int bodyType = floor (random (0, 3.9));
int featherType = floor (random (0, 2.9));

pushMatrix();
translate (18, 18);
scale (.9);
birdfeet (xcoord, ycoord);
birdfeathers (featherType, bodyType, xcoord, ycoord, b, r, g);
birdbody (bodyType, xcoord, ycoord, r, g, b);
birdeyes (xcoord, ycoord);
birdbeak (xcoord, ycoord );
popMatrix();
}
}

}

void birdfeathers (int feather, int body, float x, float y, float r, float g, float b)
{
fill (r, g, b);
strokeWeight (2);
stroke (r, g, b);

pushMatrix ();
if ((body == 0)||(body ==1))
{
translate (x, y-13);
}
else if (body ==2)
{
translate (x, y);
}
else if (body == 3)
{
translate (x, y+7);
}

if (feather==0)
{
//FEATHERRS!!!!
beginShape ();
ellipse (0, -57, 4, 18);

pushMatrix ();
translate (-3, -55);
rotate (PI/4);
ellipse (0, 0, 20, 4);
popMatrix ();

pushMatrix ();
translate (3, -55);
rotate (-PI/4);
ellipse (0, 0, 20, 4);
popMatrix ();
endShape ();
}
else if (feather ==1)
{
bezier (0, -50, 0, -45, 5, -67, 10, -65);
bezier (0, -50, 0, -45, -5, -67, -10, -65);
line (0, -50, 0, -70);
}
else
{
bezier (0, -50, 0, -45, 5, -67, 10, -65);
bezier (0, -50, 0, -45, -5, -67, -10, -65);
line (0, -50, 0, -70);
ellipse (10, -65, 10, 6);
ellipse (-10, -65, 10, 6);
ellipse (0, -70, 6, 10);
}

popMatrix ();
}

void birdbody (int body, float x, float y, float r, float g, float b)
{
fill (r, g, b);
noStroke ();

if (body==0)
{
///////UPSIDE DOWN OVAL///////
pushMatrix ();
translate (x, y-15);
beginShape();
arc (0, 0, 100, 100, PI, TWO_PI);
bezier (50, -1, 40, 90, -40, 90, -50, -1);
endShape();
popMatrix ();
}
else if (body ==1)
{
///////RIGHTSIDE UP OVAL//////
pushMatrix ();
translate (x, y);
rotate (PI);
arc (0, 0, 100, 100, PI, TWO_PI);
bezier (50, -1, 40, 90, -40, 90, -50, -1);
popMatrix ();
}
else if (body ==2)
{
/////////ROUND///////////
ellipse (x, y, 105, 105);
}
else if (body ==3)
{
///////SIDEWAYS OVAL///////
ellipse (x, y, 125, 90);
}
}

void birdfeet (float x, float y)
{
//BIRD FEET
strokeWeight (4);
strokeCap (ROUND);
stroke (139, 69, 0);
line (x-20, y+40, x-20, y+70);
line (x-20, y+60, x-30, y+65);
line (x-20,y+60, x-10, y+65);

line (x+20, y+40, x+20, y+70);
line (x+20, y+60, x+10, y+65);
line (x+20,y+60, x+30, y+65);
}

void birdeyes (float x, float y)
{
fill (0);
ellipse (x-10, y-10, 8, 8);
ellipse (x+10, y-10, 8, 8);
noStroke ();
fill (255);
ellipse (x-10, y-12, 2, 2);
ellipse (x+10, y-12, 2, 2);
}

void birdbeak (float x, float y)
{
fill (255, 170, 0);
quad (x-13, y, x, y-5, x+13, y, x, y+10);
}

void mousePressed ()
{
redraw ();
}

For this project, I had to create a function that draws a bird and use two parameters to change the shape and features of the bird, and two additional parameters to set its position. I also had to use different parameters for each bird drawn to give each a unique shape and feature. I designed three types of feathers and four different body types for the bird, as well as a generator that generates a random color everytime the mouse is clicked. This way, each bird is unique and there are no two birds that are exactly the same.