Generative Art - Sunflower
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