So as the x pos of the object increases you want the reflection center to decrease by the same amount but from the right hand side right?
The idea is that you take the value of the objects x position and subtract it from the right most pixel value of the frame (or any position you like really).
The code below assumes the layer you are moving is also the layer that has the mirror effect on it. If not you can change the second line to: MP=thisComp.layer(“yourLayerNameHere”).transform.position. or you can type MP= then pick whip the position value of the layer you want to choose as your object.
Position holds two values, x and y (or three, with a z, when it’s 3D) and you access them with a [0] or [1] after the variable holding the position information (the first value, x is held in the zero position and NOT the 1 position, so if you had a third value for a 3D object it would be in the [2] slot.
When you want to access just one of the values of a multivalue attribute like Position or alter just one of them you put them between square brackets, and separate each one by commas: [xvalue, yvalue, zvalue]; the z value is only used for 3D. Or in your particular case [[MP[0], MP[1]]. We made MP = to the whole position value of your object in the second line.
You can also do a little math inside the square brackets too and that can save you a line of code, so inside the first value holder we’re subtracting the xposition from the far right pixel value of the composition.
You can also do the whole thing in one line if you like too, getting the width of the comp to act as your far right position value.
[width-transform.position[0],transform.position[1]]
Doing it any of these ways also lets you go past the middle and the math will still work.
cmpSize=3840;
MP=transform.position;
[cmpSize-MP[0],MP[1]];