‹ pakt24 pakt26 ›

pakt25

See /f0blog/pact-februari/

//pakt25

int index;
int n;

void setup() {
  size(640, 480, JAVA2D);
  frameRate(60);
  smooth();
  strokeWeight(0.5);
  index= 0;
  background(0);
}
void draw() {
  n= int(sin(index*0.0006)*15.0+20.0);

  noStroke();
  fill(color(0, 0, 0, 5));
  rect(0, 0, width, height);

  noFill();
  stroke(255, 255);
  beginShape();
  vertex(0, height*0.5);
  for (int i= 0; i<n; i++) {
    float t= float(i)/(n-1);
    quadraticVertex(
      (t-(0.5/n))*width, 
      height*(sin(index*(sin(index*0.006)*0.02)+t)*0.5+0.5), 
      t*width, 
      height*(cos(index*(sin(index*0.002)*0.02)+t)*0.5+0.5)
      );
  }
  endShape();
  index++;
}