Created
May 18, 2018 17:08
-
-
Save pamelafox/72941972a3b22be70b5e3aa23a230c41 to your computer and use it in GitHub Desktop.
GrassyField Processing Program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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