‹ pakt05pakt07 ›

pakt06

See /f0blog/pact-februari/

//pakt06

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

void setup() {
  size(640, 480, JAVA2D);
  frameRate(60);
  strokeWeight(1);
  n= 50;
  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;
  }

  //stroke(255.0, 0.0, 0.0);
  //fill(255.0, 255.0, 255.0);
  stroke(255.0, 255.0, 255.0);
  fill(255.0, 0.0, 0.0);
}
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)*x)-(sin(theta)*y))*0.5+0.5)*width+spread;
    float vy= (((cos(theta)*y)+(sin(theta)*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;
  }
}