submission by jtoy
function setup(){
  var myCanvas = createCanvas(windowWidth,windowHeight); //you must keep this line unmodified
  cx = width/2
  cy = height/2
  sines =[] 
  cosines = []
  lt = millis()
}

function draw() {
  background(0)
  //start writing your code here
  fill(0,0,255)
  stroke(0,0,255)
  ellipse(mouseX, mouseY, 20, 20);
  noFill()
  stroke(255,0,0)
 strokeWeight(5)
 ellipse(cx-180,cy-180,400,400)
stroke(255,255,0)
 line(cx-180,cy-180,cx-180,height)
 line(cx-180,cy-180,width, cy-180)
 f = frameCount/100
 fill(0,255,0)
 stroke(0,255,0)
  x = cx-180+200*cos(f)
  y = cy-180+sin(f)*200
  ellipse(x,y,20,20)
  line(x,y,500,y)
  line(x,y,x,500)
  if(millis()-lt > 200){
    sines.unshift(y)
    cosines.unshift(x)
    lt = millis()
  }
  for(i=0;i<sines.length;i++){
   if ( sines[i+1] !== undefined ) {
     line(500+(i*10),sines[i],500+((i+1)*10),sines[i+1])
     line(cosines[i],500+(i*10),cosines[i+1],500+((i+1)*10))

   }
    ellipse(500+(i*10),sines[i],5,5)
   ellipse(cosines[i],500+(i*10),5,5)
  }

  if(sines.length > 30){
    sines.splice(-1,1)
    cosines.splice(-1,1)
  }
}