‹ pakt06pakt08 ›

pakt07

See /f0blog/pact-februari/

//pakt07

int n;
float theta, speed, spread;
float[][] pnts;

void setup() {
  size(640, 480, JAVA2D);
  frameRate(60);
  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;
  }
  fill(255.0, 0.0, 0.0);
  blendMode(DIFFERENCE);
  noStroke();
}
void draw() {
  background(0);
  for (int i= 0; i<n; i++) {
    float x= (pnts[i][0]/width)*2.0-1.0;
    float y= (pnts[i][1]/height)*2.0-1.0;
    float vx= (((cos(theta+(i*0.001))*x)-(sin(theta+(i*0.001))*y))*0.5+0.5)*width+spread;
    float vy= (((cos(theta+(i*0.001))*y)+(sin(theta+(i*0.001))*x))*0.5+0.5)*height+spread;
    pnts[i][0]= vx;
    pnts[i][1]= vy;
    ellipse(vx, vy, 50.0*2.0, 50.0*2.0);
    theta= theta+speed;
  }
}