FORUMS: list search recent posts

Modify Expression " Auto Scale Text"

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nuwan Thilina
Modify Expression " Auto Scale Text"
on Feb 2, 2020 at 4:18:49 am

Hello Experts, I need some help to modify the below expression.
This auto-scale text expression works perfectly with the width of the text.
But when changing the height of text it didn't work.

Can you help me to build an expression like ( width -100, height -200)?

w=thisComp.width-100
resize = (w/Math.round(thisLayer.sourceRectAtTime().width))*100;

if (Math.round(thisLayer.sourceRectAtTime().width) > w){

[resize,resize]

}else

[100,100];

Really appreciate your help.

Thank You,
Nuwan T.


Return to posts index

Walter Soyka
Re: Modify Expression " Auto Scale Text"
on Feb 3, 2020 at 9:10:08 pm

This should do the trick:

var maxWidth = thisComp.width - 100;
var maxHeight = thisComp.height - 200;
var myWidth = thisLayer.sourceRectAtTime(time).width;
var myHeight = thisLayer.sourceRectAtTime(time).height;

var resizeScale = Math.min(maxWidth/myWidth, maxHeight/myHeight, 1);
[resizeScale, resizeScale] * 100


Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Michael Szalapski
Re: Modify Expression " Auto Scale Text"
on Feb 3, 2020 at 10:42:58 pm

I don't have time to troubleshoot this right now (my machine is in the middle of a render), but in case you don't get an answer here soon, you might also try the Creative COW expressions forum. The code-types tend to hang out there more. :)

- The Great Szalam
(The 'Great' stands for 'Not So Great, in fact, Extremely Humble')

No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced.


Return to posts index

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