Created
September 29, 2018 19:46
-
-
Save LadyScream/1489186471e54964e216982f9e84d3ad to your computer and use it in GitHub Desktop.
"Sun"
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
boolean recording = true; | |
int frame = 1; | |
float time = 0; | |
int lines = 50; | |
float circles = 10; | |
float speed = 0.01; | |
void setup(){ | |
size(600, 600, P3D); | |
} | |
void draw(){ | |
if(time<TWO_PI || !recording){ | |
background(255, 200, 200); | |
for (int i=(int) circles; i>0; i--){ | |
pushMatrix(); | |
translate(width/2, height/2, -i); | |
float r = (width*1.5)/circles*i; | |
rotate(sin(i%2==0?time:-time)*TWO_PI/lines*3); | |
noStroke(); | |
fill(255, 200, 200); | |
ellipse(0, 0, r, r); | |
strokeWeight(10); | |
stroke(28); | |
for (int j=0; j<lines; j++){ | |
float x = cos(TWO_PI/lines*j)*r/2; | |
float y = sin(TWO_PI/lines*j)*r/2; | |
line(0, 0, x, y); | |
} | |
popMatrix(); | |
} | |
noStroke(); | |
fill(255, 200, 200); | |
pushMatrix(); | |
translate(width/2, height/2, 1); | |
ellipse(0, 0, 160, 160); | |
stroke(28); | |
ellipse(0, 0, 140, 140); | |
ellipse(0, 0, 10, 10); | |
popMatrix(); | |
time += speed; | |
if (recording && frame%2==0) save(frame+".gif"); | |
frame++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment