xxxxxxxxxx
65
let bee1;
function setup() {
createCanvas(400, 400);
bee1 = new Bee();
angleMode(DEGREES);
}
function draw() {
background("rgb(216,236,241)");
//flowers dispaly
flower(200, 100, 30);
flower(100, 200, 30);
flower(300, 300, 30);
//leaves display
leaf(200, 250, 0);
leaf(100, 310, 0);
leaf(200, 350, 0);
//bee display and movement
bee1.show();
if (mouseIsPressed) {
bee1.move();
bee1.bounce();
}
}
// leaves
function leaf(x, y, diameter) {
fill("rgb(153,190,127)");
stroke("rgb(153,190,127)");
ellipse(x, y, 40, 15);
}
// flowers
function flower(x, y, diameter) {
// save style
push();
//flower stem
stroke("rgb(144,177,122)");
fill("rgb(153,190,127)");
rect(x - 5, y, 10, 300);
// flower core
stroke("#81163A");
strokeWeight(10);
fill("#92143F");
ellipse(x, y, diameter);
// flower petals
translate(x, y);
stroke("#DA336B");
strokeWeight(3);
fill("#E04579");
for (angle = 0; angle <= 360; angle += 45) {
rotate(angle);
ellipse(0, 35, 20, 40);
}
// restore style
pop();
}