ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Autoscale when above a certain width

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Rob McLoughlin
Autoscale when above a certain width
on Feb 10, 2020 at 3:34:40 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


Return to posts index

Andrei Popa
Re: Autoscale when above a certain width
on Feb 10, 2020 at 5:02:50 pm

Try this:

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


Andrei
My Envato portfolio.


Return to posts index

Rob McLoughlin
Re: Autoscale when above a certain width
on Feb 11, 2020 at 9:54:19 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.


Return to posts index


Andrei Popa
Re: Autoscale when above a certain width
on Feb 11, 2020 at 4:09:27 pm

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

Andrei
My Envato portfolio.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]