Modify Expression " Auto Scale Text"

Moderators: Disciple, zlovatt

Post Reply
nuwanz
Posts: 1
Joined: February 2nd, 2020, 6:41 pm

Hello enhancers, This forum helped me to solve a lot of script-based problems in ae.
This is my first time posting a question.

Need expert help in modifying auto-scale text script.
I want below auto-scale text expression to work on both width and height.

Right now it only works for text length(width).
When increasing the text length script decrease the text size automatically.
But when increasing text height(or adding more text lines) it doesn't work.

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

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

[resize,resize]

}else

[100,100];

Can you help me to modify it as ".width-100.height-200"

Thank you so much,
Nuwan T.

s.kargar78
Posts: 3
Joined: February 16th, 2020, 5:03 am

hi
i think if you use this on your text it will solves your problem:

apply to anchor point:
sourceSize = thisLayer.sourceRectAtTime(time, false);
T = sourceSize.top;
L = sourceSize.left;
W = sourceSize.width;
H = sourceSize.height;
([L+ W/2,T+H/2])

apply to position:
H = thisComp.height;
W = thisComp.width;
[W/2, H/2]

apply to scale:
layerW = thisLayer.sourceRectAtTime(time).width;
compW = thisComp.width;
maxW = compW;
s = maxW / layerW * 100;
if(s>100){s=100;}
[s,s]

i find this in http://motionscript.com/
thanks Dan Ebbert

Post Reply