Make two sketches comunicate

please format code with </> button * homework policy * asking questions

Hello everyone!
I´m working on a project that consists of two sketches that communicate. In the first one, you can draw with the mouse, and when you finish you have to click a button on the second sketch display to make your drawing appear (on the second display). The problem is that the drawing must appear slowly simulating the mouse path on the first window movement, but I can’t figure out how to make this happen.
Here’s the code.
PWindow win;

public void settings() {
size(600, 600);
}
void setup() {
win = new PWindow();
}
void draw() {
if (mousePressed == true) {
frameRate(999999999);
fill(0);
ellipse(mouseX, mouseY, 20, 20);
}}
void mouseDragged() {
println(pmouseX, pmouseY);
float relPosX = map(mouseX, 0, this.width, 0, 100);
float relPosY = map(mouseY, 0, this.height, 0, 100);
win.evokedFromPrimary(relPosX, relPosY);
}
class PWindow extends PApplet {
ArrayList vectors = new ArrayList();
PWindow() {
super();
PApplet.runSketch(new String {this.getClass().getSimpleName()}, this);
}
void evokedFromPrimary(float relPosX, float relPosY) {
println(“evoked from primary”);
float xPos = map(relPosX, 0, 100, 0, this.width);
float yPos = map(relPosY, 0, 100, 0, this.height);
vectors.add(new PVector(xPos, yPos));
}
void settings() {
size(600, 600);
}
void setup() {
background(150);
}
float x = 100;
float y = 50;
float w = 150;
float h = 80;

void draw() {
rect(x,y,w,h);
fill(255);
frameRate(999999999);
if (mousePressed == true){
background(150);
//store the vector size before using to avoid ConcurrentModificationException
float listLength = vectors.size();
for(int i = 0; i < listLength; i++) {
fill(0);
PVector v = vectors.get(i);
ellipse(v.x, v.y,20, 20);
}
}
}
}

Hello,

The guidelines in the Processing FAQ asks:

Please help us help you by formatting your code on this forum. Formatted code is not only easier to read, it sometimes cannot be cut-pasted and run correctly if not formatted, making it difficult for others to help you.

Link to Processing FAQ:
https://discourse.processing.org/faq#format-your-code

``:)`

It looks like youll want to temporarily store the mouse locations either using an array or other structure.