32
20
11
11
u/Varyter Aug 06 '19 edited Aug 06 '19
took this as a challenge, took me about an hour :)
scratching my head on those sine waves
https://giant.gfycat.com/PlumpFlimsyAsianporcupine.webm
float period = 2; //seconds
float fps = 30;
float x,y;
int n_particles = 1000;
color from = #FCEF71;
color to = #DE4D60;
float amt;
float waves = 8;
void setup(){
size(1000,700);
frameRate(fps);
}
void draw(){
background(#395673);
translate(width/2, height/2);
noStroke();
for (int i=0; i<n_particles; i++) {
amt = float(i)/float(n_particles);
fill(lerpColor(from,to,amt));
x = 300*sin(PI*frameCount/(period*fps)+(amt)*PI*2);
y = 150*sin(-(waves*frameCount/(period*fps))*PI-waves*amt*PI*2)*sin(2*PI*amt);
ellipse(x,y,100,100);
}
}1
3
1
1
0
u/YJCH0I Aug 06 '19
I think it would look even better if the red end of the worm looped behind itself when it reaches the end (Once I see it, I may change my mind, but this was my initial thought when seeing this. )
1
u/Varyter Aug 06 '19
not too sure
https://gfycat.com/scornfulhotaphid
https://gfycat.com/ethicalfrightenedestuarinecrocodile
actually these could be improved with an odd wavelength so they dont exactly overlap if you know what i mean
1
u/YJCH0I Aug 06 '19
I didn’t know those other two existed (before I saw your links) but I definitely prefer the one in this post.
2
110
u/BandaLover Aug 06 '19
I like how it makes me feel like it’s coming at me