Copy link to clipboard
Copied
Hello AE friends!
I need your helping writing an if/else statement to adjust the position of a layer based on the size value of another layer. Is it even possible?!
I am creating a .mogrt lowerthird and I am trying to add an if/else conditional statement so the client has the option to add an extra line of text under 'Occpation job title'. If they add the extra line of text, the 'organisation' text layer below, needs to shift down so a gap remains between the two text boxes. Else, it stays where it is.
So if 'Text box' Shape layer size height value is greater than 90.9, 'Organisation' text layer y position is 27.3. Else y position is 14.7
Here is my current expression added to the y position value of the text layer 'Organisation'
s = thisComp.layer("Text box").content("Rectangle 1").content("Rectangle Path 1").size;
y = s.height;
if(y>90.9){(27.3)}
else{(-14.7)};
No error has come up, but it's definitely not working as nothing changes when I add an extra line of text. In the screenshot below you can see the size value of 'Text box' layer has changed but the y position of 'Organisation' text layer has remained in the else value -14.7.
I have set up expressions on the 'text box' shape layer so it auto adjusts to two different text layers. So when I add the extra line of text, the size value of the text box changes automatically. Could this be interfering with the if/else expression?
I am not very familiar with writing expressions for size and position values so any help is greatly appreciated. I have attached my AE file for you all to fiddle with.
Looking forward to your responses. Thanks heaps!
I think you just need to change:
y = s.height;
to:
y = s[1];
Copy link to clipboard
Copied
I think you just need to change:
y = s.height;
to:
y = s[1];
Copy link to clipboard
Copied
That worked! Thank you so much