xxxxxxxxxx
80
function setup() {
createCanvas(windowWidth, 400);
}
let flowerY = 380;
let flowerChange = 1;
let cloudX = 0;
let vineY = 0;
let vineChange = -1;
function draw() {
background(119, 177, 189);
noStroke();
fill(159, 219, 103); // grass
rect(0, 300, windowWidth, 100)
flower(100, 360);
flower(200, flowerY);
flower(300, 360);
flower(400, 340);
flower(440, flowerY);
flower(520, 360);
flowerY += flowerChange
if (flowerY < 340 || flowerY > 400) {
flowerChange = flowerChange * -1;
}
cloud(480, 200, 100)
cloud(160, 160, 250)
cloud(cloudX, 60, 200);
cloudX++;
if (cloudX > windowWidth) {
cloudX = 0;
}
vine(400, 0, 100);
vine(460, 0, 80);
vine(530, vineY, 120);
vine(600, 0, 200);
vineY = vineY + vineChange;
if (vineY < -100 || vineY > 0) {
vineChange = vineChange * -1;
}
} // end draw() function
function flower(x, y) {
fill(75, 99, 13); // flower stem
rect(x-2,y, 5, 100);
fill(217, 143, 192, 200); // petals
ellipse(x, y-5, 20, 20);
ellipse(x-5, y, 20, 20);
ellipse(x+5, y, 20, 20);
fill(255, 206, 43); // center
ellipse(x, y, 10, 10);
} // end flower() function
function cloud(x, y, w) {
fill(255, 255, 255);
ellipse(x,y, w, 60);
ellipse(x + 10,y - 20, w * .67, 60);
} // end cloud() function
function vine(x, y, l) {
strokeWeight(3); // stem
stroke(36, 84, 24);
line(x, y, x, y+l);
noStroke(); // leaves
fill(36, 84, 24);
ellipse(x+10, y+l, 20, 10);
ellipse(x-10, y + l * .25, 20, 10);
ellipse(x+10, y + l * .5, 20, 10);
ellipse(x-10, y + l * .75, 20, 10);
} // end vine() function