Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Text length expressions

  • Text length expressions

    Posted by Daryl Judd on March 26, 2018 at 4:54 pm

    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;

    transform.position + s;

    Daryl Judd
    KVAL Graphics

    Daryl Judd replied 8 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Roman Lehmann

    March 26, 2018 at 7:29 pm

    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: https://www.youtube.com/watch?v=kI3yzx6CATg
    – use simple math to calculate the x-position of the Last Name-comp

    cheers
    roman

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • Daryl Judd

    March 26, 2018 at 11:34 pm

    Thank you Roman, that seems to have done the trick!

    Daryl Judd
    KVAL Graphics

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy