Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects auto scale box for two lines

  • auto scale box for two lines

  • nitin kulkarni

    April 26, 2021 at 10:58 am

    Hi everyone

    I want to create a project in which there are two titles. Each of them have auto scale box . I could do this with the help of expressions, but i am stuck as both the box width should be the same, it should be which ever have longer text.

    please find image attached for better understanding

    looking forward for your help

    Thanks

  • Walter Soyka

    April 26, 2021 at 4:19 pm

    The Math.max() function returns the largest value from the arguments you pass to it, so we can set the width of both boxes to the larger of the two widths.

    The expression will look something like this:

    Math.max(thisComp.layer("Title 1").sourceRectAtTime(time).width, thisComp.layer("Title 2").sourceRectAtTime(time).width);

  • nitin kulkarni

    April 27, 2021 at 9:32 am

    thanks for your reply. after pasting this expression im getting error.

    “result must be 2 dimension and 1.”

    thanx

  • Walter Soyka

    April 27, 2021 at 11:28 pm

    Yes, that will only get you the width. If you’re putting this in a rectangle size property, or in a scale property, you will also need to calculate the height and pass both dimensions.

    Without seeing exactly what you’re doing, I can only give hints.

  • nitin kulkarni

    April 29, 2021 at 8:36 am

    hi

    I could get pass through that error. But i can not achieve to stay the rectangle with my text using Math.max the shape just keep moving in other direction

    my text are Right align.

    please find attached my project

    Thanks

Viewing 1 - 5 of 5 posts

Log in to reply.

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