Beginner question with Expressions-- How to set a if/else inside of a variable
Trying to add functionality to a basic MOGRT and I'm really rough with expressions.
On top of this graphic is a line of text (master property, in this case layer XXX).
This code is on a white box that will expand/contract it's width based on length of text in XXX.
Found out that this would work:
L= thisComp.layer("XXX");
X= L.sourceRectAtTime().width*.7; /*as the string of text in XXX gets longer, needed a multiplier to tighten up the padding... 0.7 works fro the range of possible text*/
Longer=X+8; /*needed to give some padding when XXX is just a single "i"*/
Y=100;
[Longer,Y];
So, this works great... except when there is NO text in the XXX layer.
It returns the 8. Which creates a thin white backgorund box.
What I think would work; add another variable "P" for padding.
P= if(L.sourceRectAtTime().width)>0){8}else{0}; /*this is saying 'illegal use of if'*/
and then I would change this line Longer=X+P;
