Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Scale text expression with maximum cap

  • Scale text expression with maximum cap

    Posted by Daphne Betten on October 8, 2020 at 3:52 pm

    Hello,

    I’m working on a template and I’m stuck!

    I need an expression that scales down a text layer when there’s too much text, so that it always stays inside the comp, so autoscaling. But… the layer should only scale down when it gets too big, not scale up when it is smaller than the original. So basically, never scale to less than 100%. I know about autoscaling expression but those also scale up the text. Does anyone know how to do this?

    Daphne Betten replied 5 years, 11 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    October 8, 2020 at 7:20 pm

    Something like this maybe:

    r = sourceRectAtTime(0,false);

    s = r.width > thisComp.width ? (thisComp.width/r.width)*100 : 100;

    [s,s]

  • Daphne Betten

    October 9, 2020 at 8:39 am

    Yes, that works! Do you also know how I can set a limit? so that the text always stays within a set boundary. Now it scales perfectly to the sides of the comp but I need some safe room.

  • Dan Ebberts

    October 9, 2020 at 3:04 pm

    Sure, something like this where you explicitly set the max width:

    w = 500;

    r = sourceRectAtTime(0,false);

    s = r.width > w ? (w/r.width)*100 : 100;

    [s,s]

    or, you could set it as some percentage of the comp width:

    w = thisComp.width*0.9;

  • Daphne Betten

    October 12, 2020 at 9:01 am

    It works! Thank you so much for your help.

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