If I understand you correctly you want to be able to adjust the relative heights of your two rectangles? So as the Green one gets taller the Red one gets shorter and vice versa?
No one who answered this understood what you wanted because of a terminology issue. What you referred to as Anchor Points (in every other Adobe program) are called vertices (vertex if singular) in After Effects.
SOLUTION
There are a couple of ways to do this. You can use script to link a property like one rectangles height or vertical scale to the height or scale of the other. Alternatively you could skip the script and do it with Nulls linked to the vertices of the shapes.
The set-up:
- Create two shapes, they can be shape layers, imported, whatever.
- Move the anchor point of the green box to the top of the shape, and the anchor point of red box to its bottom. (NOTE: in this case anchor point refers to the crosshairs on the layer. this is the point that all layer transformation occur from. Yo move it with the Pan Behind tool)
- Add this script to the Red Layer:
const green = thisComp.layer("Green");
const greenY = green.transform.scale.value[1];
const restY = green.effect("Rest Y Scale")(1).value;
const delta = greenY - restY;
[value[0], value[1] - delta] - Unlink the scale of the Green box and now changing it or animating it will adjust the scale of red box.
You can still add a null object to teh scene and parent the two shapes to it to control their transform properties together.
NOTE: if you want the non script way let me know and I’ll try to make a video about it.
NOTE: I use the AE beta and the AI Assistant to write this script.
NOTE: I included the AEP for the test file I created.