Skip to main content
Inspiring
May 21, 2024
Answered

expression ae: i have two layeres and i want link with maximum size but font size to be same?

  • May 21, 2024
  • 1 reply
  • 1106 views

I have layer 1 , and layer 2, but maxium size width of layer i can set by scale expression. but i want to have both layers maximum width but same font size. how to do it? 

 

for scale of text layer for maximum width and hight i use this expression:

maxW= thisComp.width * 0.30;
maxH= thisComp.height * 0.04;
r = sourceRectAtTime(time);
h = r.height;
w = r.width;
s = w/h > maxW/maxH ? maxW/w : maxH/h;
[100,100]*s

 

 

But now want both layere are linked with max width but have font size same. if both layers are separate they have more and less number of characters and their font size differs, now i want to have both have same font size , with maximum width linked for both layers.

This topic has been closed for replies.
Correct answer Dan Ebberts

I think, for layer 1 it might look like this:

maxW= thisComp.width * 0.30;
maxH= thisComp.height * 0.04;
r = sourceRectAtTime(time);
h = r.height;
w = r.width;
s = w/h > maxW/maxH ? maxW/w : maxH/h;

r2 = thisComp.layer("layer 2").sourceRectAtTime(time);
h2 = r2.height;
w2 = r2.width;
s2 = w2/h2 > maxW/maxH ? maxW/w2 : maxH/h2;

[100,100]*Math.min(s,s2)

and like this for layer 2:

maxW= thisComp.width * 0.30;
maxH= thisComp.height * 0.04;
r = sourceRectAtTime(time);
h = r.height;
w = r.width;
s = w/h > maxW/maxH ? maxW/w : maxH/h;

r2 = thisComp.layer("layer 1").sourceRectAtTime(time);
h2 = r2.height;
w2 = r2.width;
s2 = w2/h2 > maxW/maxH ? maxW/w2 : maxH/h2;

[100,100]*Math.min(s,s2)

 

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
May 21, 2024

I think, for layer 1 it might look like this:

maxW= thisComp.width * 0.30;
maxH= thisComp.height * 0.04;
r = sourceRectAtTime(time);
h = r.height;
w = r.width;
s = w/h > maxW/maxH ? maxW/w : maxH/h;

r2 = thisComp.layer("layer 2").sourceRectAtTime(time);
h2 = r2.height;
w2 = r2.width;
s2 = w2/h2 > maxW/maxH ? maxW/w2 : maxH/h2;

[100,100]*Math.min(s,s2)

and like this for layer 2:

maxW= thisComp.width * 0.30;
maxH= thisComp.height * 0.04;
r = sourceRectAtTime(time);
h = r.height;
w = r.width;
s = w/h > maxW/maxH ? maxW/w : maxH/h;

r2 = thisComp.layer("layer 1").sourceRectAtTime(time);
h2 = r2.height;
w2 = r2.width;
s2 = w2/h2 > maxW/maxH ? maxW/w2 : maxH/h2;

[100,100]*Math.min(s,s2)

 

Inspiring
May 22, 2024

Thank you @Dan Ebberts . It helped a lot