‹ pakt21pakt23 ›

pakt22

See /f0blog/pact-februari/

//pakt22
//TODO - fill rule
int index;
float w, h;
float theta;
int rows, cols;
void setup() {
  size(640, 480, JAVA2D);
  frameRate(60);
  smooth();
  noStroke();
  background(0);
  index= 0;
  w= width;
  h= height;
  cols= 10;
  rows= 14;
}
void draw() {
  fill(color(25, 0, 0, 25));
  rect(0, 0, width, height);
  fill(color(255, 0, 0));
  theta= (sin(index*0.0004)*0.1)+(sin(index*0.004)*(sin(index*0.00004)*6.0));
  float rc= (sin(index*0.051)*0.01+1.0)/cols;
  float rr= (cos(index*0.062)*0.01+1.0)/rows;
  for (int x= 0; x<cols; x++) {
    for (int y= 0; y<rows; y++) {
      float rw= sin(float(x)/cols*PI*sin(index*0.0032)+theta)*cols*5.0;
      float rh= cos(float(y)/rows*PI*cos(index*0.0034)+theta)*rows*5.0;
      if (y%2==0) {
        ellipse(rc*x*w+(rw*0.5), rr*y*h+(rw*0.5), rw*2.0, rw*2.0);
      } else {
        ellipse(rc*x*w+(rh*0.5), rr*y*h+(rh*0.5), rh*2.0, rh*2.0);
      }
    }
  }
  index++;
}