I am making a series of fully-customizable lower-thirds, that automatically scale / change based on the width of any given text layer. I have had success with linking the width of a shape layer to the width of a text layer using the following expression:
I also have a position expression linked to the size.
If I want to link a key-framed "end position" of a shape layer to the width of a text layer, how would I go about that? Below is a video of my current animation. A square rolls in then splits in two to reveal text. I want the right half of the square to automatically animate further away based on the width of the text layer. My goal is to make this as user-friendly as possible, so even an 'After Effects Novice' can edit and export!
The shape layer in question has key-framed animation on both the x-scale, and the x-position. The keyframes are eased and velocity adjusted as below.
I do realize that I'll also have to write an expression to scale the Alpha Matte in relation to the width of the text layer (which should be similar to my first expression at the top), but that's nothing I can't handle.
Playing it simple won't work, I'm afraid. You have to put up with valueAtTime() and keyframe methods since basically you want a prototype animation to have different timing and use different values. It's complicated and will require lots of extra safeties built-in to make this "novice friendly", equaliing lots of lines of code.
Thanks for the info! Here is an alternate version that I made that does work using .sourceRectAtTime().
It's not quite the same since it doesn't split from the middle, but it does accomplish the end goal! I'll keep researching to see if I can work it out like I originally wanted. Basically, I created a rectangle that was as large as I wanted the end extents to be, then animated the scale from 0 to 100, duplicated that shape layer, and converted it to an alpha inverted mask, then modified the position and width (in the expression). (The square rotating in is a separate layer.)