xxxxxxxxxx
82
/*
A garden!
*/
function setup() {
createCanvas(800, 600);
background(191, 201, 194);
frameRate(2); // draw() loops 2x per second
}
function draw() {
tree(200, 200, 100);
tree(400, 200, 200);
//cloud(100, 100);
ladybug(100, 100);
cloud1(100, 100, 255);
cloud1(400, 150, 100);
}
function cloud1(x, y, opacity) {
stroke ("white");
fill (255, 255, 255, opacity);
// x = 100, y = 100
ellipse (x, y, 75, 75);
ellipse(x + 50, y, 105, 75);
ellipse(x + 55, y, 120, 95);
}
function ladybug(x, y) {
// head
fill(0);
ellipse(x, y - 10, 40, 40);
// wings
fill(255, 0, 0);
ellipse(x - 25, y + 20, 50, 80); // left wing
ellipse(x + 25, y + 20, 50, 80); // right wing
// spots
fill(0);
ellipse(x - 30, y, 15, 15); // top left spot
ellipse(x + 20, y, 15, 15); // top right spot
ellipse(x - 20, y + 20, 15, 15); // bottom left spot
ellipse(x + 20, y + 25, 15, 15); // bottom right spot
// eyes
fill(255);
ellipse(x - 10, y - 22, 10, 10); // left eye
ellipse(x + 10, y - 22, 10, 10); // right eye
fill(0);
ellipse(x - 10, y - 22, 5, 5); // left pupil
ellipse(x + 10, y - 22, 5, 5); // right pupil
}
function tree(x, y, leaves) { // tree by Jean
noStroke();
fill(135, 82, 28);
rect(x, y, 20, 200);
strokeWeight(3);
stroke(79, 49, 9);
line(x+5, y, x+5, y + 150);
stroke(79, 45, 0);
line(x+15, y+100, x+15, y + 160);
stroke(79, 45, 0);
line(x+10, y+120, x+10, y + 180);
noStroke();
fill(0, 100, 0);
ellipse(x + 10, y, 100, leaves);
}