Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Autoscale when above a certain width

  • Autoscale when above a certain width

    Posted by Rob Mcloughlin on February 10, 2020 at 3:34 pm

    Hi All,

    Long time lurker, first time poster. I’m trying to take this expression and use it when the width of text is over a certain size, I thought this would be a case of changing the number here ‘if (w > 0)’ but I haven’t been able to get that to work. Any help would be much appreciated.

    Thanks,

    Rob.

    w = sourceRectAtTime(time,false).width;

    if (w > 0){

    s = (150/w)*100;
    h = 100;

    [s,h];

    } else

    Andrei Popa replied 6 years, 6 months ago 2 Members · 3 Replies
  • 3 Replies
  • Andrei Popa

    February 10, 2020 at 5:02 pm

    Try this:

    certainSize = 500;
    thisWidth = sourceRectAtTime(time,false).width*scale[1]/100;
    (certainSize>thisWidth) ? value : value*certainSize/thisWidth

    Andrei
    My Envato portfolio.

  • Rob Mcloughlin

    February 11, 2020 at 9:54 am

    Thanks Andrei!

    The only other thing I want to do which I had in the code I previously used was to keep the height at 100%, how would I do this?

    Thanks.

  • Andrei Popa

    February 11, 2020 at 4:09 pm

    certainSize = 500;
    thisWidth = sourceRectAtTime(time,false).width*scale[1]/100;
    (certainSize>thisWidth) ? value : [value[0]*certainSize/thisWidth,value[1]]

    Andrei
    My Envato portfolio.

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