I don’t know exactly what you’re trying to do, but here’s an expression that helped me. You can put in the position of the shape layer you want to animate.
With this rig, you can animate your controller from 0 to 100. 0 being the position of shape 1 and 100 being the position of shape 2.
First, you must put each of you shapes in a different layer.
To get the x position of a shape, you must pickwhip to the shape position and then type [0] at the end and for the y position you must type [1].
For example, x position of layer “Shape 01” would be:
thisComp.layer(“Shape 01”).transform.position[0]
Hope it helps!
a = x position of reference shape 1;
b = x position of reference shape 2;
c = y position of reference shape 1;
d = y position of reference shape 2;
x= a + thisComp.layer("controller").effect("Slider Control")("Slider")*(b-a)/100;
y= c + thisComp.layer("controller").effect("Slider Control")("Slider")*(d-c)/100;
[x, y]