‹ pakt23pakt25 ›

pakt24

See /f0blog/pact-februari/

//pakt24
//ok - patterns not exactly the same, line width
int index;
float w, h;
int n;
void setup() {
  size(640, 480, JAVA2D);
  frameRate(60);
  smooth();
  noFill();
  strokeWeight(0.1);
  index= 0;
  w= width;
  h= height;
  n= 80;
  background(255);
  stroke(0);
}
void draw() {
  float rx= sin(index*0.0012);
  float ry= sin(index*0.0022+1.0);
  float tx= sin(index*0.0032+2.0)+rx;
  float ty= sin(index*0.0042+3.0)+ry;
  fill(color(255, 255, 255, 5));
  rect(0, 0, width, height);
  float x= 0.0, y= 0.0;
  for (int i= 0; i<n; i++) {
    float t= float(i)/n*TWO_PI;
    if (i==0) {
      x= (cos((-1.0/n*TWO_PI)+rx+tx)*0.49+0.5)*w;
      y= (sin((-1.0/n*TWO_PI)+ry+ty)*0.49+0.5)*h;
    }
    float xx= (cos(t+rx+tx)*0.49+0.5)*w;
    float yy= (sin(t+ry+ty)*0.49+0.5)*h;
    bezier(x, y, (sin(t+rx+tx)*0.49+0.5)*w, (cos(t+ry+ty)*0.49+0.5)*h, xx, yy, xx, yy);
    x= xx;
    y= yy;
  }
  index++;
}