If you want the green top layer to move on the y position.
Someone might have a better expression to link something to the edge. But this is the idea you want.
x = value[0]
y = thisComp.layer(index+1).position[1] – thisComp.layer(index+1).sourceRectAtTime().height;
[x,y]
Making sure you anchorPoint is attached the bottom of the pink layer the is scaling up. This will position it to the top part of the shapeLayer.
If you are using the scale[1]. You’ll need it to calculate the percentage
x = value[0]
y = thisComp.layer(index+1).position[1] – (thisComp.layer(index+1).sourceRectAtTime().height * thisComp.layer(index+1).scale[1]/100);
[x,y]
I’m sure someone else will have a tidier expression that works better, but this should do the trick for you if your anchorPoints are set up correctly
Hope that helps.