Hi! It does not work to saddle the gif, the balls disappear because it is not necessary, and the radius does not decrease, I attach the code, please see what is wrong!
}Preformatted text
float angle;
float w = 36;
float ma;
float maxD;
float ang=0;
float angV=0.1;
void setup() {
size(600, 600, P3D);
frameRate(60);
ellipseMode(CENTER);
ma = atan(1 / sqrt(4));
maxD = dist(0, 0, width / 2, height / 2);
}
void draw() {
background(255);
translate(width/2, height/2-150,+70);
lights();
rotateX(-QUARTER_PI-PI/2);
// rotateY(ma);
rotateY(0);
for (int z = 0; z < height; z += w) {
for (int x = 0; x < width; x += w) {
pushMatrix();
float d = dist(x, z, width / 2, height / 2);
float offset = map(d, 5, maxD, -PI,PI);
float a = angle + offset;
float h = map(sin(a), -1, 1, 50, 150);
translate(x - width / 2, h, z - height / 2);
fill(0);
// noStroke();
sphere(10);
popMatrix();
}
angle+=0.01;
}
noStroke();
fill(255);
float r=map(sin(ang),-1,1,0,600);
rotateX(-PI/4);
ellipse(0,950,r2,r2);
ang+=angV;
angV+=0.00001;
}