‹ pakt22pakt24 ›

pakt23

See /f0blog/pact-februari/

//pakt23
//ok - patterns not exactly the same, line width
int index;
float w, h;
int n;
void setup() {
  size(640, 480, JAVA2D);
  frameRate(60);
  smooth();
  strokeWeight(0.1);
  index= 0;
  w= width;
  h= height;
  n= 250;
}
void draw() {
  float rx= sin(index*0.0024);
  float ry= sin(index*0.0022+1.0);
  float tx= sin(index*0.0016+2.0)+rx;
  float ty= sin(index*0.0018+3.0)+ry;
  fill(color(255, 255, 255, 5));
  rect(0, 0, width, height);
  float x= 0.5*w, y= 0.5*h;
  for (int i= 50; i<n; i++) {
    float t= float(i)/n;
    if (i==50) {
      x= (cos(t*TWO_PI*rx*tx)*0.495*t+0.5)*w;
      y= (sin(t*TWO_PI*ry*ty)*0.495*t+0.5)*h;
    } else {
      float c= map(sin(t*TWO_PI), -1.0, 1.0, 0.0, 255.0);
      stroke(c, 0, 0, c);
      float xx= (sin(t*TWO_PI*rx*tx)*0.495*t+0.5)*w;
      float yy= (cos(t*TWO_PI*ry*ty)*0.495*t+0.5)*h;
      float xxx= (cos(t*TWO_PI*rx*tx)*0.495*t+0.5)*w;
      float yyy= (sin(t*TWO_PI*ry*ty)*0.495*t+0.5)*h;
      line(x, y, xx, yy);
      line(xx, yy, xxx, yyy);
      x= xxx;
      y= yyy;
    }
  }
  index++;
}