Last active
January 24, 2019 02:41
-
-
Save jeesunikim/874286fad0d03032eede55439861eb73 to your computer and use it in GitHub Desktop.
Generative Art - Sunflower
This file contains 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
SunflowerSeedSystem SunflowerSeeds; | |
SunflowerPetals Petals; | |
float HeadMag; | |
void setup() { | |
colorMode(HSB, 360, 100, 100); | |
background(0); | |
fullScreen(); | |
SunflowerSeeds = new SunflowerSeedSystem(); | |
SunflowerSeeds.toCreateInnerHead(); | |
} | |
void draw() { | |
translate(width / 2, height / 2); | |
// Drawing Seeds | |
pushMatrix(); | |
SunflowerSeeds.toAddStyle(); | |
SunflowerSeeds.toCreateOuterHead(); | |
HeadMag = SunflowerSeeds.getHeadPositionMag(); | |
popMatrix(); | |
// Drawing Petals | |
Petals = new SunflowerPetals(HeadMag); | |
Petals.toAddStyle(); | |
Petals.createPetals(); | |
} | |
// For SAVING as an image | |
void keyPressed() { | |
if (key == 's') { | |
save("sunflower.png"); | |
saveHiRes(5); | |
exit(); | |
} | |
} | |
void saveHiRes(int scaleFactor) { | |
PGraphics hi_res = createGraphics(width*scaleFactor, height*scaleFactor, JAVA2D); | |
beginRecord(hi_res); | |
hi_res.scale(scaleFactor); | |
setup(); | |
draw(); | |
endRecord(); | |
hi_res.save("hire_sunflower.png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment