xxxxxxxxxx
var n = 0; //number of dots
var c = 3; //distance between dots
var theta; //angle of growth
var r; //distance between dots and center
var x, y; //x y coordinates
var k = 0;
var angle = 0;
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
background(0);
colorMode(HSB);
}
function draw() {
translate(width/2, height/2);
theta = n * 137.5;
r = c * sqrt(n);
x = r * cos(theta);
y = r * -sin(theta);
push();
rotate(angle);
stroke(10 + y/2, 50 + y/4, 100);
//fill(n*0.4, 40, 0);
fill(0);
ellipse(n/2, x, n/5, n/5);
ellipse(-n/2, x, n/5, n/5);
pop();
push();
stroke(y, 50 + y/4, 100);
fill(n*0.3, 40, 100 + n/4);
ellipse(x, y, k/10, k/10);
pop();
n++;
k+=0.1;
//c+=0.05;
angle++;
}