//construct3
import processing.opengl.*;
int vertices;
void setup(){
size(500,500,OPENGL);
frameRate(12);
smooth();
vertices = 16;
}
void draw(){
background(255);
translate(width/2,height/10*6,width/2);
scale(.3,.25,.4);
rotateY(radians(millis()*0.001)*90);
rotateX(radians(90));
for (int i=0; i<vertices; i++) {
pushMatrix();
beginShape();
for (int j=0; j<vertices; j++){
translate(0,0,i);
float jX = cos(j)*vertices*sin(i)*i;
float jY = sin(j)*vertices*cos(i)*j;
float jZ = cos(j)*vertices*sin(i)*j;
float colorX = abs(jX);
float colorY = abs(jY);
float colorZ = abs(jZ);
fill(colorX,colorY,colorZ,135);
vertex(jX,jY,jZ);
}
endShape();
popMatrix();
}
}