Skip to content

Instantly share code, notes, and snippets.

@volfegan
Last active May 27, 2022 18:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volfegan/4b2ac32ddf90a2e567fa7b0459aadca7 to your computer and use it in GitHub Desktop.
Save volfegan/4b2ac32ddf90a2e567fa7b0459aadca7 to your computer and use it in GitHub Desktop.
High altitude view of some 8bit XOR blue ocean waves
//remix https://www.dwitter.net/d/23922
float a, b, d, m, r, w, z, t, X, Y;
void setup() {
size(1280, 720);
noStroke();
fill(0,128,255);
}
void draw() {
background(-1);
t+=.02;
z=w=180;
d=-.05;
for (m=2e4; m > 0; m--) {
X=m%w;
Y=m/w;
a=X/90-1;
b=Y/90-1.6;
r=a*a+b*b;
z=sin(a/d*r+t*4)-cos(b/d+t*7);
//z=atan(a/d*r+t*4)-atan(b/d+t*7);//waves moving away from the shore
//z=sin(a/d*r+t*4)-atan(b/d+t*7);//sideway waves moving
rect(X, Y, cos(X/5-(round(1*sin(23*Y-t*3)) ^ round(39*Y)) - 1*cos(X/7+t*4)+t*7)/z+1, z*.4);
}
copy(this.get(), 0, 0, (int)w, (int)(2e4/w), 0, 0, width, height);
//saveFrame("frame_######.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment