Skip to content

Instantly share code, notes, and snippets.

@jeesunikim
Last active January 24, 2019 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeesunikim/493827756bbc78308a5a97fd2b348eb5 to your computer and use it in GitHub Desktop.
Save jeesunikim/493827756bbc78308a5a97fd2b348eb5 to your computer and use it in GitHub Desktop.
Generative Art - Sunflower - Seed System
class SunflowerSeedSystem {
SunflowerSeed[] seeds = new SunflowerSeed[2800];
PVector HeadPosition;
void toCreateInnerHead() {
int coreSeeds = 300;
int headSeeds = seeds.length - coreSeeds;
for(int i=0; i<seeds.length; i++) {
if(i < coreSeeds) {
seeds[i] = new SunflowerSeed(60, 55, 30, 1);
} else if(i > coreSeeds && i <= headSeeds) {
seeds[i] = new SunflowerSeed(1, 1, 1, 2);
} else {
seeds[i] = new SunflowerSeed(0.1, 1.7, 1.7, 5);
}
}
}
void toCreateOuterHead() {
for (int i = 0; i < seeds.length; i++) {
float c = 11;
float a = i * radians(137.5);
float r = c * sqrt(i);
HeadPosition = new PVector(r * cos(a), r * sin(a));
// Updating Each Seed //<>//
seeds[i].toUpdateShape(HeadPosition.x, HeadPosition.y);
}
}
float getHeadPositionMag() {
return HeadPosition.mag() + 40;
}
void toAddStyle() {
float SatRange = random(0, 5);
float BrightRange = random(60, 90);
strokeWeight(0.07);
stroke(0, SatRange, BrightRange);
fill(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment