Last active
June 24, 2024 13:29
-
-
Save Shinichi-Ohki/67ab5351ac3d169aad6f68f5dd165c4c to your computer and use it in GitHub Desktop.
This file contains 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
void setup() { | |
size(640, 400); | |
color[] c = {#000000,#0000FF,#FF0000,#FF00FF,#00FF00,#00FFFF,#FFFF00,#FFFFFF}; | |
background(c[0]); | |
strokeWeight(2); | |
int[] d = new int[160]; | |
for (int i = 1; i < 160; i++) { | |
d[i] = 100; | |
} | |
float dr = 3.14/180; | |
for (float y = -180; y <= 180; y += 6) { | |
for (float x = -180; x <= 180; x += 4) { | |
float r = dr*sqrt(x*x+y*y); | |
float z = 100*cos(r)-30*cos(3*r); | |
int sx = int(80+(x/3)-(y/6)); | |
int sy = int(40-(y/6)-(z/4)); | |
if ((sx < 0) || (sx >= 160)) continue; | |
if (d[sx]<=sy) continue; | |
int zz = int(((z+100)*0.035)+1); | |
stroke(c[zz]); | |
point(sx*2,sy*2); | |
d[sx] = sy; | |
} | |
} | |
} | |
void draw() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment