Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions More elegant Text Scale solution

  • More elegant Text Scale solution

    Posted by Chris Meadmore on October 17, 2018 at 4:52 pm

    Hi,

    I’ve written this expression:

    layerWidth = thisLayer.sourceRectAtTime(time).width;
    maximumWidth = 650;
    percentageOfMaxWidth = layerWidth / maximumWidth * 100;
    leeway = 100 - percentageOfMaxWidth;
    if (layerWidth < 650) [110,110]
    else [100 + leeway, 100 + leeway]

    Which works really well on my text scale… as the text goes beyond a 650 pixels it begins to scale down to stay within the comp. Issue is as it scales down it begins to jump larger and larger percentages.

    What I really want is for the right side of my text box to remain at the 650 pixel distance.

    Can anyone help?

    FYI, text is left aligned.

    Thanks.

    Filip Vandueren replied 7 years, 10 months ago 2 Members · 1 Reply
  • 1 Reply
  • Filip Vandueren

    October 20, 2018 at 10:50 pm

    This works for me:

    layerWidth = thisLayer.sourceRectAtTime(time).width*scale[0]/100;

    if (layerWidth!=0 && layerWidth>650) {
    value * 650/layerWidth;
    } else {
    value;
    }

    should be fine unless you’re also having parenting and scaling going on in that parent…

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