Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Scale background to text

  • Scale background to text

    Posted by Gary Devaan on November 10, 2016 at 10:42 pm

    I’m using the first block of code to scale my background to a line of text, but I would like to also add a TITLE text layer. Can I use something like on the bottomto say either of the layers whatever is longest to determine the background size?

    x = thisComp.layer("NAME").sourceRectAtTime().width+150;
    y = value[1];
    [x,y]

    ------------------------------------

    x = thisComp.layer("NAME" || "TITLE").sourceRectAtTime().width+150;
    y = value[1];
    [x,y]

    Kevin Camp replied 9 years, 10 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kevin Camp

    November 10, 2016 at 11:17 pm

    try this:

    w1 = thisComp.layer(“NAME”).sourceRectAtTime().width;
    w2 = thisComp.layer(“TITLE”).sourceRectAtTime().width;
    x = Math.max(w1,w2)+150;
    y = value[1];
    [x,y]

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

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