Using colors with variables

That is yours to code, there is no built-in functions for that.

Here is an example. It allows just two mouse click: the first one sets the starting point and the second one the end point. You can play with the step value to see how it affects the result:

int step;
int nbOfStrokes;
int prevY, prevX;

void setup() {
  size(800, 600);
  step = 1;
  nbOfStrokes = 0;
  background(20);
  fill(255, 25, 25);
  noStroke();
}

void draw() {
  
}

void mousePressed() {
  if (nbOfStrokes == 0) {
    prevY = mouseY;
    prevX = mouseX;
    ellipse(mouseX, mouseY, 20, 20);
  } else if (nbOfStrokes == 1) {
    interpolateStrokes(prevX, prevY, mouseX, mouseY);
  }
  
  nbOfStrokes++;
}

void interpolateStrokes(int prevX, int prevY, int newX, int newY) {
  PVector dir = new PVector(newX - prevX, newY - prevY);
  int maxLength = (int)pow(dir.mag(), 2);
  
  dir.normalize();
  dir.mult(step);
  
  PVector pos = new PVector(prevX, prevY);
  pos.add(dir);
  
  while ((pos.x - prevX) * (pos.x - prevX) + (pos.y - prevY) * (pos.y - prevY) < maxLength) {
    ellipse(pos.x, pos.y, 20, 20);
    pos.add(dir);
  }
}