Boglar: Variation on a theme by Victor Vasarely
int NUM=15; float h1, h2, t, w, p, a, q, k;
void setup()
{
size(600,600); frameRate(30); colorMode(HSB,360,100,100);
smooth(); noStroke(); h1=20; h2=240; t=0; w=0.6;
p=0.15; q=0; a=width/NUM; k=4*(sqrt(2)-1)/3;
}
void draw()
{
int i, j; t+=1/30.0;
h1=(h1+0.11)%360; h2=(h2+0.19)%360;
for(i=0;i<NUM;i++){
for(j=0;j<NUM;j++){
fill(h1+(h2-h1)*((i+j)%2), 80,
100-100/NUM*(abs(i-NUM/2)+abs(j-NUM/2)));
rect(i*a,j*a,a,a);
q=k*(3+cos(0.5*t+(i+j)%2*PI))/4*(1-2*p);
fill(h1+(h2-h1)*((i+j+1)%2), 80,
100-100/NUM*(abs(i-NUM/2)+abs(j-NUM/2)));
beginShape();
vertex((i+0.5)*a, (j+p)*a);
bezierVertex((i+0.5+q)*a, (j+p)*a, (i+1-p)*a,
(j+0.5-q)*a, (i+1-p)*a, (j+0.5)*a);
bezierVertex((i+1-p)*a, (j+0.5+q)*a, (i+0.5+q)*a,
(j+1-p)*a, (i+0.5)*a, (j+1-p)*a);
bezierVertex((i+0.5-q)*a, (j+1-p)*a, (i+p)*a,
(j+0.5+q)*a, (i+p)*a, (j+.5)*a);
bezierVertex((i+p)*a, (j+0.5-q)*a, (i+0.5-q)*a,
(j+p)*a, (i+0.5)*a, (j+p)*a);
endShape();
}
}
}
Boglar
Home