int circles = 1000; float[][] circlep = new float[circles][2]; float circleR = 5; void setup() { frameRate(20); size(200, 200); noStroke(); smooth(); float theta = PI; for (int i = 0; i < circles; i += 1) { float radius = (theta / (TWO_PI)) * circleR + (0.1 * s); float circumference = PI * radius * 2; float nPerCircle = circumference / circleR; theta = theta + (TWO_PI / nPerCircle); float[] p = p2c(radius, theta); circlep[i][0] = p[0]; circlep[i][1] = p[1]; } } int s = 0; int n =0; void draw() { background(0,0,0); // Translate the origin point to the center of the screen translate(width/2, height/2); n++; for (int i = 0; i < circles; i += 1) { int j = i + n; if (j % 6 == 0) { fill(255,255,255); ellipse(circlep[i][0], circlep[i][1], circleR, circleR); } if (j % 6 == 3) { fill(0,255,255); ellipse(circlep[i][0], circlep[i][1], circleR, circleR); } } s++; } float[] p2c(float r, float theta) { float x = r * cos(theta); float y = r * sin(theta); float[] result = {x, y}; return(result); }