float x, y; int radius = 100; int deg = 255; float angle; float ang= 1; void setup(){ size(400,400); background(255); noStroke(); fill(0,60); x = width/2 + (cos(4.5) * radius); y = height/2 +(sin(4.5) * radius); } void draw(){ ellipse(x,y,1,1); ellipse(width-x,y,1,1); x+= sin(ang); y-= cos(ang); ang = random(6.28); if (dist(width/2,height/2, x,y)>150){ deg = deg - 30; angle = radians(deg); x = width/2 + (cos(angle) * radius); y = height/2 + (sin(angle) * radius); } }