Skip to content

Instantly share code, notes, and snippets.

@tequibo
Created April 3, 2021 20:20
Show Gist options
  • Select an option

  • Save tequibo/525f65fdf5e9732b8a04a135a0521dea to your computer and use it in GitHub Desktop.

Select an option

Save tequibo/525f65fdf5e9732b8a04a135a0521dea to your computer and use it in GitHub Desktop.
float t=0, t2=0, w=750, h=750, step=100, s;
int framesAmount=100, recordCounter=0;
void setup() {
size(750, 750);
smooth();
colorMode(HSB, 360, 100, 100);
frameRate(50);
}
void circle(float size, int am, float i_size, float dir, float t3, float a, color c) {
for (int i=0; i<am; i++) {
t2=float(i)*TAU/float(am);
noFill();
s=5;
fill(c);
pushMatrix();
translate(w/2+sin(t2+t3)*size, h/2+cos(t2+t3)*size);
rotate(t2+t3);
//ellipse(0, 0, i_size, i_size);
float an=TAU/12+PI;
//float i_size = m_size+sin(t2*3+t3*dir)*m_size/2;
triangle(cos(an)*i_size, sin(an)*i_size, cos(an+TAU/3)*i_size, sin(an+TAU/3)*i_size, cos(an+TAU/3*2)*i_size, sin(an+TAU/3*2)*i_size);
popMatrix();
}
}
int am2 = 50;
float size2 = 9;
color color1 = color(1, 100, 25);
color color2 = color(155, 100, 100);
void draw() {
noStroke();
fill(#13001a);
rect(0, 0, width, height);
t+=TAU/framesAmount;
for (int i=0; i<am2; i++) {
float n = float(i)/am2;
float dir = i%2==0?-1:1;
color c = color(260+sin(t*2+n*PI*6)*60, 100, 100);//color(i%2==0?color(180+sin(-t+n*TAU)*180,100,100):color(180+sin(-t+n*TAU)*180,100,100));
//color c = color(1,100,80+sin(-t+n*TAU*6)*20);
float t_corr=t/i;
float s = float(i)/am2*size2;
circle(float(i)*25+sin(t+n*TAU*2)*25, i*3, size2, dir, t_corr, float(i)/12, c);
}
for (int i=0; i<am2; i++) {
float n = float(i)/am2;
float dir = i%2==0?-1:1;
color c = color(160+sin(t*2+PI+n*PI*6)*60, 100, 100);//color(i%2==0?color(180+sin(-t+n*TAU)*180,100,100):color(180+sin(-t+n*TAU)*180,100,100));
//color c = color(1,100,80+sin(-t+n*TAU*6)*20);
float t_corr=t/i;
float s = float(i)/am2*size2;
circle(float(i)*25+sin(t-.2+n*TAU*2)*25, i*3, size2, dir, t_corr, float(i)/12, c);
}
fill(#171717);
//ellipse(w/2, h/2, size2, size2);
if (recordCounter<framesAmount &&record) {
recordCounter++;
saveFrame("frames/frame_###.gif");
}
}
void mouseClicked() {
recordCounter=0;
record=true;
}
boolean record=false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment