Processing coding help - Sliders

Hello, could someone look into my code? I don’t know how to continue.
I had to code 4 Sliders. Two are following the Y-direction and two the X-direction. But one of the two sliders have to go to the opposide direction and I don’t know how to do that. Could someone help me out? I wrote a note the the slider that has to go to the opposide direction.Thanks in advance!

void setup() {
  surface.setTitle("MalKlein_MalGross");
  size(500, 500);
  surface.setLocation(250, 250); //Skizze zentriert am Bildschirm anzeigen

}
void draw() {
    background(255, 255, 255);
    stroke(0);
    
 //Seitenlinien mit 15 Abstand, parallel zu den Rändern
  strokeWeight(3);
  line(0, 15, 500, 15);
  strokeWeight(3);
  line(15, 0, 15, 500);
  strokeWeight(3);
  line(0, 485, 500, 485);
  strokeWeight(3);
  line(485, 0, 485, 500);

  //Beschriftungen werden angegeben & Schriftgrößen
  fill(0, 255, 0);
  textSize(12);
  text("Links", 20, 10);

  fill(0, 255, 0);
  textSize(12);
  text("Groß", 20, 30);

  fill(0, 255, 0);
  textSize(12);
  text("Rechts", 445, 10);

  fill(255, 0, 0);
  textSize(12);
  text("Groß", 455, 30);

  fill(0, 255, 0);
  textSize(12);
  text("Klein", 20, 480);

  fill(255, 0, 0);
  textSize(12);
  text("Links", 20, 497);

  fill(255, 0, 0);
  textSize(12);
  text("Klein", 455, 480);

  fill(255, 0, 0);
  textSize(12);
  text("Rechts", 445, 497);

//Alle 4 Slider kommen dazu **HERE ARE THE SLIDERS**
  fill(0, 255, 0);
  noStroke();
  square(12, mouseY, 6);
  
  //Hier entgegengesetzt **THIS ONE HAS TO GO TO THE OPPOSIDE DIRECTION OF THE ONE ABOVE**
    fill(255, 0, 0);
  noStroke();
  square(483, mouseY, 6);
  
    fill(255, 0, 0);
  noStroke();
  ellipse(mouseX, 485, 5,10);
  
  //Hier auch entgegengesetzt **THIS ONE HAS TO GO THE OPPSIDE DIRECTION OF THE ONE ABOVE**
   fill(0, 255, 0);
  noStroke();
  ellipse(mouseX, 16, 5,10); 
}

Hello,

Please format your code:
https://processing.org/reference/map_.html

:)

1 Like

If you want the direction to be inversed, then take width - mouseX and height - mouseY
respectively

also only format the code please, otherwise we cant see your question

1 Like

Thank you so much! :grinning: