function setup() {
createCanvas(450, 450);
angleMode(DEGREES);
}
function draw() {
translate(width/2,width/2)
background(0);
t = 200*sin(frameCount/2)
stroke(255)
strokeWeight(0.1)
fill(200+t/4, 119-t, 200+t/2,5)
for (let i=-width/2; i <= 360; i=i+ 10) {
y = 100*sin(t+i)+10*cos(t+i)
x = 100*cos(t*2+i)-10*sin(t+i)
circle(x,y,150)
}
fill(19+t/2, 255-t/4, 180+t/2,5)
for (let i=-width/2; i <= 360; i=i+ 10) {
y = 100*sin(t+i)+10*cos(t+i)
x = 100*cos(t*2+i)-10*sin(t+i)
circle(y,-x,150)
}
fill(255-t,205-t,255,5)
push()
rotate(45)
for (let i=-width/2; i <= 360; i=i+ 10) {
y = 100*sin(t+i)+10*cos(t+i)
x = 100*cos(t*2+i)-10*sin(t+i)
circle(y,-x,150)
}
pop()
fill(50+t/3,255-t/2,105,5)
push()
rotate(45)
for (let i=-width/2; i <= 360; i=i+ 10) {
y = 100*sin(t+i)+10*cos(t+i)
x = 100*cos(t*2+i)-10*sin(t+i)
circle(y,x,150)
}
rotate(-45)
circleWindow(t)
}
function circleWindow(t){
noStroke()
fill(0,0,0,t+100)
beginShape()
for (let i=0; i <= 180; i++) {
x = 180*cos(i)
y = (120-abs(2*t/4.5))*sin(i)
vertex(x,y)
}
vertex(-width/2,0)
vertex(-width/2, height/2);
vertex(width/2, height/2);
vertex(width/2,0)
endShape(CLOSE);
beginShape()
for (let i=180; i <= 360; i++) {
x = 180*cos(i)
y = (120-abs(2*t/4.5))*sin(i)
vertex(x,y)
}
vertex(width/2,0)
vertex(width/2, -height/2);
vertex(-width/2, -height/2);
vertex(-width/2,0)
endShape(CLOSE);
}