ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
fabien farrachi
Choose between the smallest value "X scale" of 3 layers
on Oct 3, 2018 at 11:38:47 am
Last 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 !

Thanks in advance !
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
]


Return to posts index

fabien farrachi
Re: Choose between the smallest value "X scale" of 3 layers
on 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]


Return to posts index

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