r=100
l=255
d=290;;
n=6
function setup(){
createCanvas(600,600,WEBGL);
noStroke();
fill(55,205,255,250);
background(0);
angleMode(DEGREES)
}
function draw(){
background(0,0,0,);
t=frameCount/5;
fill(55,205,255-50*sin(t),250);
rotateY(90);
pointLight(l,l,l,0,0,r+50);
pointLight(l,l,l,r+50,0,0);
pointLight(l,l,l,-(r+50),0,0);
pointLight(l,l,l,0,-(r+50),0);
pointLight(l,l,l,0,(r+50),0);
plotEntity(r);
fill(55-50*sin(t),255-100*sin(t),205+50*cos(t),220);
for(let i=0;i<n;i++){
push()
rotateX(360/n*i)
translate(d,d,0)
plotEntity(r*1.5);
pop()
}
fill(50+100*sin(t),50,50+100*cos(t),150);
for(let i=0;i<n;i++){
push()
rotateX(360/n*i+(360/n)/2)
translate(d/2,d/2,0)
plotEntity(r/2);
pop()
}
fill(200-100*cos(t),200,100+100*cos(t),100)
for(let i=0;i<n;i++){
push()
rotateX(360/n*i+(360/n)/2)
translate(d*2,d*2,0)
plotEntity(r*3);
pop()
}
}
function plotEntity(r1){
push()
rotateX(t);
sphere(r1,4,2);
pop()
push()
rotateX(-t);
sphere(r1,4,2);
pop()
push()
rotateY(t);
sphere(r1,4,2);
pop()
push()
rotateY(-t);
sphere(r1,4,2);
pop()
}
function mousePressed(){
n=n+1;
if (n>20){
n=2
}
}