I was making a Java processing code that basically records where 20 of your mouse clicks and draws lines that connect the vector point of each mouse click to the center of the screen, which in this case is 600x600. I was able to create the lines but I am stuck on how I could be able to make the lines move into the center. Do you guys have any suggestions for how I could make it happen?
float[] Xcont = new float[0];
float[] Ycont = new float[0];
int clickCounter = 0;
float centerX = 300;
float centerY = 300;
float amt = 1;
void setup(){
size(600, 600);
background(0);
}
void draw(){
stroke(255);
if(clickCounter == 20){
for(int i = 0; i < Xcont.length; i+=1){
line(Xcont[i], Ycont[i], centerX, centerY);
circle(Xcont[i], Ycont[i], 10);
}
}
}
void mousePressed(){
clickCounter+=1;
if(clickCounter <= 20){
Xcont = append(Xcont, mouseX);
Ycont = append(Ycont, mouseY);
println(mouseX, mouseY);
}
if(clickCounter == 20){
println(Xcont);
}
}