Watermelons!
Here's code for endlessly generating watermelons, with the rind color changing depending on if the mouse is pressed.
void setup() {
//canvas color
background(255);
//size of the canvas
size(600, 600);
noStroke();
frameRate(24);
}
void draw() {
if (mousePressed) {
float x = random(100, 500);
float y = random(0, 500);
fill(153, 153, 255);
arc(x, y, 200, 200, 0, PI, OPEN);
fill(182,214,131);
arc(x, y, 180, 180, 0, PI, OPEN);
fill(211,54,45);
arc(x, y, 175, 175, 0, PI, OPEN);
fill(0);
ellipse(x-40,y+50,8,8);
ellipse(x,y+50,8,8);
ellipse(x+40,y+50,8,8);
ellipse(x-20,y+25,8,8);
ellipse(x+20,y+25,8,8);
} else {
float x = random(100, 500);
float y = random(0, 500);
fill(81, 119, 26);
arc(x, y, 200, 200, 0, PI, OPEN);
fill(182,214,131);
arc(x, y, 180, 180, 0, PI, OPEN);
fill(211,54,45);
arc(x, y, 175, 175, 0, PI, OPEN);
fill(0);
ellipse(x-40,y+50,8,8);
ellipse(x,y+50,8,8);
ellipse(x+40,y+50,8,8);
ellipse(x-20,y+25,8,8);
ellipse(x+20,y+25,8,8);
}
}
Nice work!
ReplyDelete