xxxxxxxxxx
float tmax, x1, y1;
//http://mathlesstraveled.com/2015/06/04/random-cyclic-curves-5/
void setup()
{
size(800, 800);
background(255);
}
void draw()
{
background(255);
tmax = map(mouseX, 0, width, 0, TWO_PI);
x1 = cos(0) + 1.0/2 * cos(6*0) - 1.0/3 * sin(-14*0);
y1 = sin(0) + 1.0/2 * sin(6*0) + 1.0/3 * cos(-14*0);
x1 = map(x1, -3, 3, 0, width);
y1 = map(y1, -3, 3, height, 0);
for (float t = 0; t < tmax; t+=0.005)
{
float x = cos(t) + 1.0/2 * cos(6*t) - 1.0/3*sin(-14*t);
float y = sin(t) + 1.0/2 * sin(6*t) + 1.0/3*cos(-14*t);
x = map(x, -3, 3, 0, width);
y = map(y, -3, 3, height, 0);
line(x, y, x1, y1);
x1 = x;
y1 = y;
}
}