Last active
April 8, 2021 02:54
-
-
Save volfegan/7f59cefe58d22e8348f3659b97f4f445 to your computer and use it in GitHub Desktop.
Vaporwave/Retrowave aesthetics with a floating Fish
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
//references | |
//https://www.dwitter.net/d/1829 | |
//https://twitter.com/i_bri/status/1378588143931260930 | |
float l, r, t=0; | |
void setup() { | |
size(1280, 720); | |
stroke(0, 255, 0); | |
noFill(); | |
} | |
void draw() { | |
t+=0.02; | |
clear(); | |
//Horizon sky | |
for (float i=height/2; i>0; i-=3) { | |
stroke(lerpColor(#9E00FF, #FFEF00, 2*i/height)); | |
line(0, i, width, i); | |
} | |
//Background floor | |
for (float i=-100; i<100; i++) { | |
float parallax = 40*sin(t+(i*(16/100))*.1-PI/3); | |
line(width/2+i*100-parallax*2, height, width/2+i*10+parallax, height/2); | |
r=5*(exp(i/10)-1); | |
l=height/2+r+r*(exp((-t*.2)%0.69)-1); // %0.5 for smooth line movements | |
line(0, l, width, l); | |
} | |
//Sun | |
stroke(#FFEF00, 100); | |
for (int i=99; i>0; i--) { | |
float d = round(random(120+69*abs(sin(t)))); | |
float b=20+d*.5; | |
float y = height/2.1+b*sin(d); | |
float parallax = 25*sin(t+(i*(16/99))*.1-PI/3); | |
if (y < height/2-9) | |
rect(width*.75+parallax+b*cos(d), y, 5, 5); | |
} | |
//Fish | |
stroke(0, 255, 0); | |
for (float i=-1; i<16; i+=.75) { | |
translate(width/2, height/2); | |
rotate(1.6+.5*sin(t*.5)+9.5); | |
ellipse(120*sin(t+i*.1), 240*cos(t+i*.1), 160*sin(-i*.5)+160, 50*sin(i*.1)+5); | |
resetMatrix(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment