Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Two dynamic boxes with relationship with each other

  • Two dynamic boxes with relationship with each other

    Posted by Emiliano Grimaldi on September 5, 2019 at 10:30 am

    Hi all,

    I have two dynamic boxes/titles that should have a relationship with each other.
    The two boxes contain titles and are on top of each other on the Y-axis.
    I would like an expression that makes both boxes/titles expand to the width of the longer box/title, i.e. The one with the longer text dictates the width of the titles.

    Thank you for any help!

    I used the expression below to create the boxes

    title = thisComp.layer("Title").sourceRectAtTime();padding = effect("Padding")("Slider");[title.width + padding, title.height + padding];

    http://www.emilianogrimaldi.it
    https://emilianogrimaldi.blogspot.com

    Emiliano Grimaldi replied 6 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    September 5, 2019 at 1:34 pm

    I haven’t test this, but I think it might look like this:

    title1 = thisComp.layer(“Title 1”).sourceRectAtTime();
    title2 = thisComp.layer(“Title 2”).sourceRectAtTime();
    w = Math.max(title1.width,title2.width);
    h = Math.max(title1.height,title2.height);
    padding = effect(“Padding”)(“Slider”);
    [w + padding, h + padding];

    Dan

  • Emiliano Grimaldi

    September 9, 2019 at 10:42 am

    Dan,

    Thank you very much!

    This works like a charm!!!

    Emiliano

    http://www.emilianogrimaldi.it
    https://emilianogrimaldi.blogspot.com

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