let x=0,
y=0,
a=100;
function setup() {
createCanvas(400, 400);
background(0);
stroke(255);
plotP();
}
function draw() {
translate(width/3,width/2); stroke(random(50,255),random(50,255),random(50,255))
}
function mousePressed(){
if(mouseX-width/2>width/3-a){
msX = mouseX- width/3;
msY = mouseY-width/2;
m = (msY)/(msX-a);
a1 = m*m;
b1 = -(2*a*m*m+4*a);
c1 = a*a*m*m;
tmp = (b1*b1-4*a1*c1)
x1 = (-b1-sqrt(tmp))/(2*a1);
y1 = sqrt(4*a*x1);
if(msY<0){
line(msX,msY,x1,y1);
line(x1,y1,width,y1)
}
if(msY>=0){
line(msX,msY,x1,-y1);
line(x1,-y1,width,-y1)
}
}
}
function plotP(){
translate(width/3,width/2);
for (i=-100;i<100;i=i+1){
t=i/90;
y=2*a*t;
x=a*t*t;
circle(x,y,2);
circle(a,0,10);
line(-a,-width/2,-a,width/2)
}
}