By having the layer parented you make it a bit harder. If you want the second layer to follow the x coord of the first layer, but mirror the y coord this will do it (without the second layer being parented)
var centerY = thisComp.height/2;
var p = thisComp.layer("the name of the controlling layer").transform.position;
[p[0], centerY - p[1]]
If do you need the second layer to be parented the following should work. Because the distance from the parent to the centre point is the same as the distance from the center point to the child, we can just multiply it by two to get the y distance in the layer space of the parent:
var centreY = thisComp.height/2;
[value[0], 2*(centreY - parent.position[1])];
Both of these expressions will mirror around the centre of the comp vertically. You could mirror around an arbitrary y point by specifying it on the first line instead of thisComp.height/2
, e.g.: var centerY = 1234
.
You could also use another layer as the control of the mirror point by using this instead of that expression: var centerY = thisComp.layer("name of center control layer").transform.position[1]