ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Choose between the smallest value "X scale" of 3 layers

FAQ   •   VIEW ALL
 Choose between the smallest value "X scale" of 3 layers on Oct 3, 2018 at 11:38:47 amLast Edited By fabien farrachi on Oct 3, 2018 at 6:45:00 pm

Hi
I would like to adjust the X scale of 3 text layers depending of the smallest resizing one.
I have this composition of layer
NAME
SURNAME
COUNTRY

The scale should be always at the max X size of 1620 pixels. and 100% (or 160px) in Y
In this case lets say that, in order to fit 1620px, NAME is scaled to X: 160% , SURNAME to 110% and COUNTRY to 118%
So, once we know that, i want the 3 layers to take the smallest scale value.

Is it possible ?
I tried this code....but i'm not an expert as you are !

Fabien

```a=thisComp.layer("NAME").transform.scale[0]; b=thisComp.layer("SURNAME").transform.scale[0]; c=thisComp.layer("COUNTRY").transform.scale[0]; max = Math.max(Math.max(a,b),c); min = Math.min(Math.min(a,b),c); if (a &lt; max){if (a > min) mid=a else mid=Math.min(b,c);} {mid = Math.max(b,c)}; mid ] ```

 Re: Choose between the smallest value "X scale" of 3 layerson Oct 4, 2018 at 8:13:52 am

I found it !! ðŸ˜‰
this is the good expression below
i just duplicated the 3 text layers and linked the source txt to the 3 below. (and turned them of)
I enter the text in the 3 new layers, and i put expression in the scale of the 3 old layers.

```a=thisComp.layer("NAME").transform.scale[0]; b=thisComp.layer("SURNAME").transform.scale[0]; c=thisComp.layer("COUNTRY").transform.scale[0]; F=[Math.min(Math.min(a,b),c)]; Y=transform.scale[1]; [F,Y]```