sketchDownload
// Kyli Hilaire - Project 05
// khilaire@andrew.cmu.edu
// Section B
var x = 0;
var y = 0;
var beeWidth = 30;
var beeLength = 38;
var stripeY = 0;
function setup() {
createCanvas(400, 300);
background(247, 183, 191);
}
function draw() {
bgStripes();
// draw background stripes
push();
translate(-45, -18);
// move bees in the canvas
for(x = 0; x <= 500; x += 75) {
for(y = 0; y <= 400; y += 75) {
bee();
}
} pop();
// draw bees
for(x = 0; x <= 500; x += 75){
for(y = 0; y <= 400; y += 75){
greenCircles();
}
}
// draw green circles
}
function bee() {
beeWings();
beeBody();
}
function beeBody() {
stroke(245, 242, 158);
strokeWeight(1);
fill(255, 255, 188);
ellipse(x + 50, y + 50, beeWidth, beeLength);
// yellow oval
stroke(80);
strokeWeight(4);
line(x + 39, y + 42, x + 61, y + 42);
line(x + 38, y + 52, x + 62, y + 52);
line(x + 41, y + 62, x + 59, y + 62);
// draw bee stripes
noStroke();
fill(95)
triangle(x + 44, y + 68, x + 56, y + 68, x + 50, y + 74);
// stinger
}
function beeWings() {
noStroke();
fill(255, 255, 240);
arc(x + 50, y + 50, 65, 50, 11*PI/6, PI/6);
arc(x + 50, y + 50, 65, 50, 5*PI/6, 7*PI/6);
// bee wing arcs
stroke(0);
strokeWeight(1);
line(x + 50, y + 50, x + 75, y + 50);
line(x + 25, y + 50, x + 50, y + 50);
}
function bgStripes() {
for(let i = 0; i <= 300; i += 10) {
stroke(255, 251, 236);
strokeWeight(0.75);
line(0, stripeY + 2, 400, stripeY + 2);
stripeY += 16
// space lines 16px apart
}
}
function greenCircles() {
noStroke();
fill(216, 238, 219);
circle(x + 14, y + 61, 5);
circle(x + 20, y + 54, 8);
circle(x + 22, y + 63, 3);
// bottom right of bee
circle(x + 60, y + 10, 5);
circle(x + 65, y + 7, 3);
// upper left of bee
stroke(216, 238, 219);
strokeWeight(2);
point(x + 61, y + 3);
// small point upper left
}