View the code ⇓

Beta: Variation on a theme by Victor Vasarely

int NUM=23, delta_X;
float t, w, h2, s2, X, Y, radius;

void setup() 
{
  size(600,600); frameRate(30); noFill(); 
  colorMode(HSB,360,100,100); smooth();
  t=0; w=0.6; h2=random(0,360); s2=random(50,100);
  X=width/2; Y=height/2; delta_X=width/(2*NUM);
}
void draw() 
{
  float x, y; int i; t+= 1/30.0; h2=(h2+0.1)%360;
  radius = X/2*(1+0.75*cos(w*t));
  background(0); stroke(h2,s2,80);
  for(i=0;i<NUM;i++)
  {
    strokeWeight(3);
    x=delta_X*i;
    rect(X-x,X-x,2*x,2*x);
    if(x*sqrt(2)<radius){
      strokeWeight(9); rect(X-x,X-x,2*x,2*x);}
    else if(x<radius){
      strokeWeight(9);
      y=sqrt(radius*radius-x*x);
      line(X+x,X-y,X+x,X+y);
      line(X-x,X-y,X-x,X+y);
      line(X-y,X+x,X+y,X+x);
      line(X-y,X-x,X+y,X-x);     
    }
  }  
}

Return to top ⇑