Hello Amy,
One of my most-used expressions for this sort of things is the “linear()” expression. Here’s the Adobe ref guide on it: https://helpx.adobe.com/after-effects/using/expression-language-reference.html#:~:text=Interpolation%20methods%20(expression,range%20of%20values.
But here’s some quick and simple ideas. If you write this in the position property of an object:
x = linear(time, 0, 3, 10, 200);
[x, 0]
This will make the object move from position 10 to position 200 in between 0 and 3 seconds on the X axis.
And then you can use variables to make sure the positions and timings are correct:
var s = thisComp.layer(“text here:)”);
var start = s.inPoint;
var end = s.outPoint;
var mid = (end-start)/2;
var w = s.sourceRectAtTime(mid).width/2;
var h = s.sourceRectAtTime(mid).height/2;
var t = s.sourceRectAtTime(mid).top;
var l = s.sourceRectAtTime(mid).left;
x = linear(time, start, end, l, w);
y = h+t;
[x, y];
I’m not 100% sure that will work correctly for you, I haven’t tested it, but that might give you an idea of how to work it.
As you continue to build this, you could also use the “Trim paths” effect to grow the line down and up, and when you do this you can also use the linear() expression to grow the line.
Hope that helps and shout if there’s anything you don’t understand on this! I’ve built a few things like this, so if you want to share what you’ve done at any time I’d be happy to comment! I’m a big fan of templating things properly so I lean on Afx fairly heavily.
helpx.adobe.com
Expression language reference
Learn about expressions and expression references such as time conversion methods and vector math methods in After Effects.