int NUM=3, NUM_CHANGE=2, a=32; float P=26.0, t, w1, w2; void setup() { size(600,600); frameRate(30); noFill(); strokeWeight(5); stroke(255); smooth(); ellipseMode(CENTER); t=0; w1=2*PI/P; w2=-PI/P; } void draw() { int i, j; t=t+1/30.0; if(t>P/2){ t=t-P/2; NUM=NUM+NUM_CHANGE; if(NUM*a>width*sqrt(2)){NUM_CHANGE=-2;} else if(NUM==3){NUM_CHANGE=+2;} } background(0); for(i=-NUM/2;i<=NUM/2;i++){ for(j=-NUM/2;j<=NUM/2;j++){ ellipse(width/2+i*a*sin(w1*t)+j*a*cos(w1*t), width/2+i*a*cos(w1*t)-j*a*sin(w1*t), .8*a, .8*a); ellipse(width/2+i*a*sin(w2*t)+j*a*cos(w2*t), width/2+i*a*cos(w2*t)-j*a*sin(w2*t), .8*a, .8*a); } } }