/*Carley Johnson
Section E
cbjohnso@andrew.cmu.edu
Project 05
*/
var d = 25;
function setup() {
createCanvas(640, 480);
background(255, 228, 233);
}
function draw() {
for(var y = 0; y < 20; y += 2) {
for(var x = 0; x < 20; x += 3) {
// Bird body
fill(0, 223, 252);
stroke(0);
rect((x*d * 1.5 - 185) + y * 25,
25 + y*d * 2, d + 9, d + 2,
0, 20, 20, 20);
//Bird beak
fill(255, 178, 76);
stroke(0);
triangle((x*d * 1.5 - 152) + y * 25, 35 + y*d * 2,
(x*d * 1.5 - 152) + y * 25, 40 + y*d * 2,
(x*d * 1.5 - 140) + y * 25, 35 + y*d * 2)
//Bird eye
fill(0);
stroke(0);
ellipse((x*d * 1.5 - 160) + y * 25, 33 + y*d * 2,
3, 3)
//Bird wing
fill(154, 242, 253);
stroke(142, 216, 252);
bezier((x*d * 1.5 - 184) + y * 25, 38 + y*d * 2,
(x*d * 1.5 - 175) + y * 25, 55 + y*d * 2,
(x*d * 1.5 - 170) + y * 25, 55 + y*d * 2,
(x*d * 1.5 - 160) + y * 25, 38 + y*d * 2)
//Bird food
fill(255, 178, 76);
stroke(0);
ellipse((x*d * 1.5 - 110) + y * 25, 33 + y*d * 2,
5, 5)
}
}
}
I knew I wanted to do birds, because I think birds are an adorable and eccentric pattern. (I have a rain jacket with a repeating bird silhouette pattern on it that I love, pictured above) so I chose that. For a while I was trying to create five thousand variables for each individual shape, but that was making different patterns with each shape, not following where the body was. Then I realized that I could simplify the process by using the same variables (which also unified where the objects appeared) and had to live with the retrospective embarrassment of taking so long to figure it out. But I think this is adorable, so, worth it!