int bgcolor = 0x888888; PFont font; float diameter = 100; float radius = 50; float centerX = 100; float centerY = 100; float x = 0.0f; float y = 0.0f; float angle = 0.0f; float frequency = 2.0f; int counter = 0; int[] coordsX = new int[360/(int)frequency]; int[] coordsY = new int[360/(int)frequency]; void setup() { size(400, 250); background(bgcolor); font = createFont("Arial", 24); textFont(font); } void draw() { background(bgcolor); // calculate point x = centerX + cos(radians(angle)) * radius; y = centerY + sin(radians(angle)) * radius; // draw circle noStroke(); fill(255); ellipse(centerX, centerY, diameter, diameter); // draw point fill(0); ellipse(x, y, 10, 10); ellipse(centerX + radius + counter, y, 10, 10); stroke(255); for(int i = 0; i < counter; ++i) point(coordsX[i], coordsY[i]); stroke(#aaaaaa); line(x, y, centerX + radius + counter, y); // adjust counter and angle coordsX[counter] = (int)(centerX + radius + counter); coordsY[counter] = (int)y; ++counter; angle -= frequency; if(angle <= -360) { angle = 0; counter = 0; } // output text coordinates //fill(255); //text("x = " + (int)x, 60, 190); //text("y = " + (int)y, 60, 220); //text("angle = " + (int)angle, 200, 220); }