Skip to content

Instantly share code, notes, and snippets.

@clemp
Created March 30, 2020 22:01
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 clemp/a028c81afe6e58c88bbd120924a715a5 to your computer and use it in GitHub Desktop.
Save clemp/a028c81afe6e58c88bbd120924a715a5 to your computer and use it in GitHub Desktop.
Expanding ellipses
int count;
int maxradius = 40;
float growth = 0.6;
// perlin noise incrementer
float xoff;
void setup() {
size(400, 400);
// initialize parameters
count = 0;
xoff = 0.0;
}
void draw() {
background(0);
// set drawing parameters
noFill();
stroke(255);
// expand circle until a certain point, then stop
if (count < maxradius) {
ellipse(width/2, height/4, count*growth, count*growth);
}
// expand circle until a certain point, then repeat
float rad = count % maxradius;
ellipse(width/2, height/2, rad*growth, rad*growth);
// expand circle radius randomly
float randomrad = (count % maxradius) * noise(xoff);
//ellipse(width/2, 300, randomrad, randomrad);
ellipse(width/2, 300, randomrad, randomrad);
xoff += 0.03;
count++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment