-
Script for comparing layer height for positioning.
I am working on a template that needs to compare the first three layers. I’m checking to see which layer is the tallest. Here is what I have for the expression.
VH1 = thisComp.layer(1).height;
VH2 = thisComp.layer(2).height;
VH3 = thisComp.layer(3).height;VH1S = VH1*([thisComp.layer(1).transform.scale[0]]/100);
VH2S = VH2*([thisComp.layer(2).transform.scale[0]]/100);
VH3S = VH3*([thisComp.layer(3).transform.scale[0]]/100);if ( VH1S >= VH2S && VH3S )
H = VH1Selse if ( VH2S >= VH1S && VH3S )
H = VH2Selse if ( VH3S >= VH1S && VH2S )
H = VH3S50 + H - VH3S
The problem is that in this case the third if statement for some reason is never true.
I tried changing the code like so:
VH1 = thisComp.layer(1).height;
VH2 = thisComp.layer(2).height;
VH3 = thisComp.layer(3).height;VH1S = VH1*([thisComp.layer(1).transform.scale[0]]/100);
VH2S = VH2*([thisComp.layer(2).transform.scale[0]]/100);
VH3S = VH3*([thisComp.layer(3).transform.scale[0]]/100);if ( VH1S >= VH2S && VH3S )
H = VH1Sif ( VH2S >= VH1S && VH3S )
H = VH2Sif ( VH3S >= VH1S && VH2S )
H = VH3S50 + H - VH3S
But then the second if statement is never true…am I missing something?
Any help is appreciated.
-bsides