xxxxxxxxxx
88
function setup() {
createCanvas(600, 600);
noStroke();
}
function draw() {
background(51, 153, 51);
let s = second();
console.log(s)
//decorativeleaves
fill(0, 100, 0);
ellipse(50, 325, 50, 25);
ellipse(75, 350, 25, 50);
fill(255,255,255)
circle (70,325,10)
fill(0, 100, 0);
ellipse(550, 275, 70, 35);
ellipse(575, 300, 35, 70);
fill(255,255,255)
circle (575,275,15)
fill(0, 100, 0);
ellipse(525, 25, 50, 25);
ellipse(500, 50, 25, 50);
fill(255,255,255)
circle (500,25,10)
fill(0, 100, 0);
ellipse(225, 525, 60, 30);
fill(0, 100, 0);
ellipse(250, 500, 30, 60);
fill(0, 100, 0);
ellipse(100, 50, 25, 50);
fill(0, 100, 0);
ellipse(75, 75, 50, 25);
fill(0, 100, 0);
ellipse(525, 525, 50, 25);
fill(0, 100, 0);
ellipse(550, 500, 25, 50);
fill(255,255,255)
circle (550,525,10)
//morningglory
//leaves
fill(0, 100, 0);
ellipse(300, 200, 100, 200);
fill(0, 100, 0);
ellipse(200, 300, 200, 100);
//flower
push();
translate(300,300);
if (s > 22) {
fill(255,255,255);
} else {
fill(62,69,137);
}
if (polygon > polygon(0, 0, 100-s*5, 7)){
polygon == polygon(0, 0, 100-s*5, 7);
}
pop();
//outercenter
fill(255,255,255)
circle (300,300,25)
//innercenter
fill(255, 255, 153)
circle (300,300,15)
}
function polygon(x, y, radius, npoints) {
let angle = TWO_PI / npoints;
beginShape();
for (let a = 0; a < TWO_PI; a += angle) {
let sx = x + cos(a) * radius;
let sy = y + sin(a) * radius;
vertex(sx, sy);
}
endShape(CLOSE);
}