pakt24
See /f0blog/pact-februari/
//pakt24
int index;
int n;
void setup() {
size(640, 480, JAVA2D);
frameRate(60);
smooth();
strokeWeight(0.1);
index= 0;
n= 80;
background(175);
}
void draw() {
float rx= sin(index*0.0012);
float ry= sin(index*0.0022+1.0);
float tx= sin(index*0.0032+2.0)+rx;
float ty= sin(index*0.0042+3.0)+ry;
noStroke();
fill(color(255, 255, 255, 5));
rect(0, 0, width, height);
noFill();
stroke(0, 255);
beginShape();
vertex((cos((-1.0/n*TWO_PI)+rx+tx)*0.49+0.5)*width, (sin((-1.0/n*TWO_PI)+ry+ty)*0.49+0.5)*height);
for (int i= 0; i<n; i++) {
float t= float(i)/n*TWO_PI;
PVector p = new PVector((sin(t+rx+tx)*0.49+0.5)*width, (cos(t+ry+ty)*0.49+0.5)*height);
PVector q = new PVector((cos(t+rx+tx)*0.49+0.5)*width, (sin(t+ry+ty)*0.49+0.5)*height);
quadraticVertex(p.x, p.y, q.x, q.y);
}
endShape();
index++;
}