Rotating Circle


float theta, radius;
void setup() {
  size(400,400);
  radius = 100;
  theta = 0;
}

void draw() {
  float x,y;
  background(150);
  
  // creates the red track
  fill(150);
  stroke(255,0,0);
  circle(width/2,height/2,radius*2);
  
  // creates the blue rotating line
  x = radius * cos(theta) + width/2.;
  y = radius * sin(-theta) + height/2.;
  stroke(0,0,255);
  strokeWeight(2);
  line(width/2,height/2,x,y);
  
  // creates the rotating circle
  fill(255);
  stroke(0);
  strokeWeight(1);
  circle(x,y,75);
  
  theta += PI/180;
  
}