pakt23
See /f0blog/pact-februari/
//pakt23
int index;
int n;
void setup() {
size(640, 480, JAVA2D);
frameRate(60);
smooth();
background(175);
index= 0;
n= 250;
}
void draw() {
float rx= sin(index*0.0024);
float ry= sin(index*0.0022+1.0);
float tx= sin(index*0.0016+2.0)+rx;
float ty= sin(index*0.0018+3.0)+ry;
noStroke();
fill(color(255, 255, 255, 5));
rect(0, 0, width, height);
float x= 0.5*width, y= 0.5*height;
for (int i= 50; i<n; i++) {
float t= float(i)/n;
if (i==50) {
x= (cos(t*TWO_PI*rx*tx)*0.495*t+0.5)*width;
y= (sin(t*TWO_PI*ry*ty)*0.495*t+0.5)*height;
} else {
float c= map(sin(t*TWO_PI), -1.0, 1.0, 0.0, 255.0);
stroke(c, 0, 0, c);
float xx= (sin(t*TWO_PI*rx*tx)*0.495*t+0.5)*width;
float yy= (cos(t*TWO_PI*ry*ty)*0.495*t+0.5)*height;
float xxx= (cos(t*TWO_PI*rx*tx)*0.495*t+0.5)*width;
float yyy= (sin(t*TWO_PI*ry*ty)*0.495*t+0.5)*height;
line(x, y, xx, yy);
line(xx, yy, xxx, yyy);
x= xxx;
y= yyy;
}
}
index++;
}