Processing 3 Translate and Rotate function taking triangle out of canvas

Hi. I am trying to horizontally flip a triangle and have it placed on the canvas. I want to create buttons for a carousel slide… Here’s the code:

//Buttons
noStroke();
triangle(triangleRX1, triangleRY1, triangleRX2and3, triangleRY2, triangleRX2and3, triangleRY3);
pushMatrix();
translate(1053.75, 0);
rotate(radians(180));
translate(width/2,height/2);
triangle(triangleRX1, triangleRY1, triangleRX2and3, triangleRY2, triangleRX2and3, triangleRY3);
popMatrix();

If it were a rectangle I could have kept the origin at the center using rectmode(). Unfortunately, for a triangle, I don’t know how the rotate function is supposed to work. What am I doing wrong?
Here’s a zipped version of the processing file if that helps:

Oops, my bad. The zipped file might have the rotate and the translate function commented up. So you might have to uncomment it before hitting run. Sorry.