View the code ⇓

CTA2: Variation on a theme by Victor Vasarely

int NUM=16;
float d1, s2, t, w, h;

void setup()
{
  size(600,600); smooth(); noStroke();
  colorMode(HSB,360,100,100); frameRate(30);
  s2=width/(NUM*1.0); d1=s2/2.0;
  t=0; w=0.5; h=0;
}

void draw()
{  
  int n; float theta, x, y;
  t=t+1/30.0; h=(h+0.1)%360;
  background(h,30,50);
  for(n=0; n<NUM*NUM; n++){
    theta=PI*sin(PI*(n%NUM +0.5)/NUM)/4.0;
    theta*=sin(PI*(n/NUM +0.5)/NUM);
    fill(h,70,400*theta/PI);
    theta=theta*cos(w*t);
    x=(n%NUM +0.5)*s2; y=(n/NUM +0.5)*s2;
    quad(x + d1*cos(PI/4+theta), y + d1*sin(PI/4+theta),
         x + d1*cos(3*PI/4+theta), y + d1*sin(3*PI/4+theta),
         x+ d1*cos(5*PI/4+theta), y + d1*sin(5*PI/4+theta),
         x + d1*cos(7*PI/4+theta), y + d1*sin(7*PI/4+theta));
  }
}

Return to top ⇑