‹ pakt06pakt08 ›

pakt07

See /f0blog/pact-februari/

//pakt07
//wrong filling rule
int n;
float w, h;
float theta, speed, spread;
float[][] pnts;
void setup() {
  size(640, 480, JAVA2D);
  frameRate(60);
  noFill();
  n= 30;
  theta= 0.0;
  speed= 0.00002;
  spread= 1.0;
  pnts= new float[n][2];
  for (int i= 0; i<n; i++) {
    pnts[i][0]= width*0.5;
    pnts[i][1]= height*0.5;
  }
  w= width;
  h= height;
  stroke(255.0, 0.0, 0.0);
}
void draw() {
  background(0);
  for (int i= 0; i<n; i++) {
    float x= (pnts[i][0]/w)*2.0-1.0;
    float y= (pnts[i][1]/h)*2.0-1.0;
    float vx= (((cos(theta+(i*0.001))*x)-(sin(theta+(i*0.001))*y))*0.5+0.5)*w+spread;
    float vy= (((cos(theta+(i*0.001))*y)+(sin(theta+(i*0.001))*x))*0.5+0.5)*h+spread;
    pnts[i][0]= vx;
    pnts[i][1]= vy;
    ellipse(vx, vy, 50.0*2.0, 50.0*2.0);
    theta= theta+speed;
  }
}