Capella: Variation on a theme by Victor Vasarely
float cX, cY, r, y, deltaY, orig, om, t, sp, h;
void setup()
{
size(600,600); smooth(); colorMode(HSB,360,100,100);
frameRate(30); cX=width/2; cY=height/2; sp=width/14.0;
om=5; t=0; h=0;
}
void draw()
{
t+=1/30.0; orig = om*(1+cos(0.2*t))/2;
deltaY=2*orig; background(255); fill(0);
h=(h+0.1)%360;
for(y=-cY; y<cY; y=y+sp){
stroke(0); fill(h,75,100-70*(cY+y)/height);
rect(0,cY+y,width,sp);
noStroke(); fill(0);
rect(0,cY+y-deltaY/4,width,deltaY/2);}
for(r=6.5*sp; r>sp; r-=sp){
for(y=-cY; y<cY; y=y+sp){
if(abs(y)+om<r){
beginShape();
vertex(cX+sqrt(pow(r,2)-pow(y-deltaY,2)),cY+y-deltaY);
vertex(cX+sqrt(pow(r,2)-pow(y,2)),cY+y);
vertex(cX+sqrt(pow(r,2)-pow(y+deltaY,2)),cY+y+deltaY);
vertex(cX-sqrt(pow(r,2)-pow(y+deltaY,2)),cY+y+deltaY);
vertex(cX-sqrt(pow(r,2)-pow(y,2)), cY+y);
vertex(cX-sqrt(pow(r,2)-pow(y-deltaY,2)),cY+y-deltaY);
endShape(CLOSE);}
}
deltaY+=orig;
}
}
Capella
Home