-
Math.Max instead of if else
Hi, I have an expression I use often to scale down text once it reaches a certain length.
I have applied it a null and parented 2 text layers to it, and used an if else statement to resize according to which text reaches that length first. The 2 layers need to stay the same relative size to each other, but their animations are different, so they need to stay as seperate text layers.
Is it possible to rewrite this expression with a math.max instead of an if else. I am asking in case I have too many layers one day, here is my code as is, I have tried over and over to apply the math.max but it doesn’t work as expected;
x= thisComp.layer(“TEXT1”).sourceRectAtTime(3).width;
y= thisComp.layer(“TEXT2”).sourceRectAtTime(3).width;
a=(1920/x)*44;
b=(1920/y)*44;
xclamp= clamp(a,1,100);
yclamp= clamp(b,1,100);
if(x>y) [xclamp,xclamp]; else [yclamp,yclamp]]
thanks