再帰であそぶ その2 (2026/5/8)
https://gyazo.com/888f49de400a66c5e6d677a16f5ee7c4 https://gyazo.com/d48ea335b4fa199377a48177bc2826a5 https://gyazo.com/62ac02a185343e52871184146822e588
https://scrapbox.io/files/69fcab844a47cec3dce43f12.mp4
https://x.com/hisadan/status/2052405407256396186
https://x.com/hisadan/status/2052405409764561067
code:processing
//#Processing
float t;
void setup() {
size(800, 800);
rectMode(CENTER);
}
void draw() {
background(-1);
a(400, 400, 200);
t+=.01;
}
void a(float x, float y, float d) {
if (d>9) {
push();
if (d%2==0) {
square(x, y, 2*d*(1+cos(t)));
} else {
circle(x, y, 2*d*(1-cos(t)));
}
a(x+d, y+d, d/2);
a(x-d, y+d, d/2);
a(x+d, y-d, d/2);
a(x-d, y-d, d/2);
pop();
}
}