xxxxxxxxxx
function setup() {
createCanvas(600*0.9, 800*0.9);
}
function draw() {
const velocity = frameCount/100 + sin(frameCount/1200)*10;
const horizonY = height * 0.2 + sin(velocity * 1.2) * 50;
const groundH = 200 + sin(velocity) * 20;
const flowerSize = 60;
background("#87ceeb");
noStroke();
fill("#000000");
rect(0, horizonY, width, groundH);
fill("#8b4513");
rect(0, horizonY+groundH, width, height);
fill("#008000");
var x1 = width/2;
beginShape();
vertex(x1 - flowerSize/2, horizonY);
vertex(x1 + flowerSize/2, horizonY);
vertex(x1 + flowerSize, horizonY+groundH);
vertex(x1 - flowerSize, horizonY+groundH);
endShape();
fill("#ff0000");
ellipse(width/2, horizonY, flowerSize, flowerSize*1.3);
noFill();
strokeWeight(3);
stroke("#ff0000");
for(var j = 0; j < 2; j++){
beginShape();
for(var i = 0; i < 100; i++){
var x = sin(i/100*TWO_PI*3+j*PI+frameCount/50*(j+1)) * 50 + width/2;
var y = i/100 * (height-horizonY-groundH-80) + horizonY + groundH;
vertex(x, y);
}
endShape();
}
noStroke();
fill("#ffdab9");
ellipse(width/2, height - 80, 100, 120);
fill("#e7d903");
for(var i = 0; i < 10; i++){
var x = cos(i/10*TWO_PI * i/5 + velocity) * flowerSize + width/2;
var y = sin(i/10*TWO_PI * i/3 + velocity) * (height-horizonY-groundH-80)/2 + horizonY + groundH + (height-horizonY-groundH)/2;
circle(x, y, 10);
}
}