ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

More elegant Text Scale solution

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Chris Meadmore
More elegant Text Scale solution
on Oct 17, 2018 at 4:52:41 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.


Return to posts index

Filip Vandueren
Re: More elegant Text Scale solution
on Oct 20, 2018 at 10:50:05 pm
Last Edited By Filip Vandueren on Oct 20, 2018 at 10:55:13 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…


Return to posts index

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