Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GrassyField Processing Program
void setup() {
size(640, 360);
}
void draw() {
colorMode(HSB);
// Draw blue sky
background(134, 74, 255);
// Draw grassy ground
fill(81, 97, 219);
rect(0, 300, width, 100);
for (int i = 0; i < 15; i++) {
int randomX = (int)random(0, width);
int randomY = (int)random(300, height);
color randomC = color(random(0, 255), random(190, 255), 255);
drawFlower(randomX, randomY, randomC);
}
noLoop();
}
void drawFlower(int x, int y, color c) {
stroke(80, 200, 100);
strokeWeight(3);
line(x, y, x, y-30);
fill(c);
noStroke();
ellipse(x, y-30, 15, 13);
rect(x-8, y-40, 16, 13);
triangle(x+4, y-40, x+8, y-40, x+6, y-45);
triangle(x-2, y-40, x+2, y-40, x, y-45);
triangle(x-4, y-40, x-8, y-40, x-6, y-45);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.