再帰は楽し (2026/6/8)
https://gyazo.com/7d2210a84d25b5e3f2279ea3139165f5 https://gyazo.com/7d30ed57b4b1358248339c3d9d371b33 https://gyazo.com/48e036597e8768dfb60a1649e78c59b9
https://scrapbox.io/files/6a26b35d601c8b4efdd15e67.mp4
https://x.com/hisadan/status/2063958669650530357
https://x.com/hisadan/status/2063958672921997399
code:processing
//#Processing
float t;
void setup() {
size(800, 800, P3D);
}
void draw() {
background(0);
camera(900*sin(t), 500*cos(t), 900*cos(t), 0, 0, 0, 0, -1, 0);
lights();
fill(-1, 128*(1+cos(t)));
stroke(-1, 128*(1-cos(t)));
a(0, 0, 0, 300);
t+=.01;
}
void a(float x, float y, float z, float d) {
if (d>10) {
push();
translate(x, y, z);
if (d<100) {
box(d);
} else {
sphere(d);
}
for (float k=-d*3; k<=d*3; k+=6*d) {
a(0, 0, k*sin(t), d/2);
a(0, k*sin(t), 0, d/2);
a(k*sin(t), 0, 0, d/2);
}
pop();
}
}