Creating a temperature simulation

Thanks for your help, I somehow managed to create the arrow but the triangle is not connected to the actual rectangle. I don’t know why, and the Image is also covering the arrow. Any solution how to fix this?

PImage bathImg;


void setup() {
  size(1000,800);
  
  noStroke();
  
  bathImg = loadImage("...");
  
beginShape();
triangle(5,20,30,5,55,20);
stroke(0);
rect(5, 200, 50, 500);
stroke(0);
endShape();
}

void draw() {
image(bathImg, 0, 0);

float  x1 = map(mouseX, 0, width, 50, 150);
ellipse(x1, 75, 50, 50);  
float x2 = map(mouseX, 0, width, 0, 200);
ellipse(x2, 125, 50, 50); 
}