Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Conditional expression for box size

  • Conditional expression for box size

    Posted by Andrew Mcclure on October 4, 2018 at 4:35 pm

    Hi all, I’m trying to create a text box that will size to the to width of the longest text.

    Currently using this conditional expression but it only works for the first 2 values

    n = thisComp.layer("NAME TEXT").sourceRectAtTime();
    p = thisComp.layer("PROFESSION TEXT").sourceRectAtTime();
    u = thisComp.layer("USERNAME TEXT").sourceRectAtTime();

    if ((n.width > p.width) || (n.width > u.width)) {
    [n.width + 100, 135]
    }
    else if ((p.width > n.width) || (p.width > u.width)) {
    [p.width + 100, 135]
    }
    else {
    [u.width + 100, 135]
    }

    Not sure what I am doing wrong, thanks for your help!

    Andrew Mcclure replied 7 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 4, 2018 at 5:24 pm

    Try it with && instead of ||

    Dan

  • Andrew Mcclure

    October 4, 2018 at 5:38 pm

    Worked! Thank you so much Dan!

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