I've found several threads that are close to what I need, but haven't come across the right combination. I have a comp that has a first name layer, and a last name layer. In a separate comp, I want to combine them into one row. So I need to find the length of the first name, and add that to the x-position of the second name, so they are spaced correctly. The expression works with shorter names, but doesn't adjust correctly for longer names.
Is it because length is the number of characters, which is different than the width in pixels? Any ideas of what might work?
temp = thisComp.layer("FIRST NAME").text.sourceText;
s = temp.length*25;
Did you try the following?
- check the little sun icon (Collapse Transformation) with the two comps (you'll get the original size and not the comp size)
- use the expression sourceRectAtTime(time) explained here:
- use simple math to calculate the x-position of the Last Name-comp