ArrayList<PVector> points;
void setup(){
size(500, 500, P3D);
noStroke();
fill(255);
points = new ArrayList<PVector>();
for(int i = 0; i < 150; i++){
float r = random(100, 150);
float rad1 = random(PI);
float rad2 = random(TWO_PI);
float x = r * sin(rad1) * cos(rad2);
float y = r * cos(rad1);
float z = r * sin(rad1) * sin(rad2);
points.add(new PVector(x, y, z));
}
}
void draw(){
background(32);
lights();
translate(width / 2, height / 2, (height / 2.0) / tan(PI * 30.0 / 180.0));
rotateX(frameCount * 0.005);
rotateY(frameCount * 0.01);
rotateZ(frameCount * 0.015);
for(PVector p: points){
pushMatrix();
translate(p.x, p.y, p.z);
sphere(5);
popMatrix();
}
}