Created
December 15, 2015 09:39
-
-
Save ciaron/54987900e8b28dbce6c1 to your computer and use it in GitHub Desktop.
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
import java.util.Calendar; | |
int bg=0; | |
int fg=255; | |
int y; | |
int[] ysd = new int[12]; | |
int[] ysu = new int[8]; | |
int d=220; | |
float t=0.0; | |
color[] palette = {#2D4059, #EA5455, #F07B3F,#FFD460}; | |
void setup () { | |
size(540, 540, P2D); | |
frameRate(30); | |
background(bg); | |
strokeCap(SQUARE); | |
for (int i=0; i<ysd.length; i++) { | |
ysd[i] = int(lerp(-d,d,float(i)/ysd.length)); | |
} | |
for (int i=0; i<ysu.length; i++) { | |
ysu[i] = int(lerp(-d,d,float(i)/ysu.length)); | |
} | |
} | |
void draw () { | |
// Fade or not? | |
background(bg); | |
//fill(bg, 127); | |
//noStroke(); | |
//rect(0, 0, width, height); | |
noFill(); | |
pushMatrix(); | |
translate(width/2, height/2); | |
stroke(100); | |
for (int i=0; i<ysu.length; i++) { | |
float sw = (map(abs(ysu[i]), 0, d, 12, 6)); | |
stroke(palette[i % palette.length]); | |
strokeWeight(sw); | |
float x1=0.9*(int(-1*sqrt(sq(d)-sq(ysu[i])))); | |
float x2 = x1 * -1; | |
line(x1, ysu[i], x2, ysu[i]); | |
ysu[i]-=1; | |
if (ysu[i]<-d) | |
ysu[i]=d; | |
} | |
popMatrix(); | |
pushMatrix(); | |
translate(width/2, height/2); | |
stroke(fg); | |
for (int i=0; i<ysd.length; i++) { | |
float sw = (map(abs(ysd[i]), 0, d, 12, 6)); | |
strokeWeight(sw); | |
stroke(palette[i % palette.length]); | |
int x1=int(-1*sqrt(sq(d)-sq(ysd[i]))); | |
int x2 = x1 * -1; | |
line(x1, ysd[i], x2, ysd[i]); | |
ysd[i]+=2; | |
if (ysd[i]>d) | |
ysd[i]=-d; | |
} | |
popMatrix(); | |
t+=0.01; | |
//saveFrame("frame-####.png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment