xxxxxxxxxx
// translate, random, cos, sin, map, rotate, vertex, parametric.
// Mouse click.
float n, incr, h, v;
boolean cw;
void setup() {
//size(600, 600);
fullscreen();
background(0);
colorMode(HSB, 360, 100, 100);
v = random(1, 200);
incr = 0;
cw = true;
}
void draw() {
background(0);
translate(width/2, height/2);
h = map(sin(incr*100), -1, 1, 238, 300);
stroke(h, 80, 80, 100);
if (cw)incr += 0.0002;
else incr -= 0.0002;
// v = map(mouseX, 0, width, 1, 200);
n = map(sin(incr*v), -1, 1, 100, 220);
for (int i = 0; i < 360; i += 2) {
rotate(incr);
float x = cos(radians(i)) * n;
float y = sin(radians(x)) * n;
beginShape();
vertex(-x, -y);
vertex(y, x);
endShape();
ellipse(-x, -y, 2, 2);
ellipse(y, x, 2, 2);
}
}
void mousePressed() {
incr = random(-1, 1);
v = random(1, 200);
cw = !cw;
}