-
If/Else Statement + Source Text + Position Coordinates
Hi Guys,
I’m trying to write an expression to set the exact X,Y coordinates of a layer based on the Source Text of another layer.
• Text layer named “SETUP”
• Solid named: “S1”When the source text for “SETUP” says: “Target1” I’d like the position of S1 to be at 760,340.
Here is the expression I have on the position of S1:
input = thisComp.layer("SETUP").text.sourceText;
xPos = if( (input == "Target1") ) 760 else 0;
yPos = if( (input == "Target1") ) 340 else 0;
[xPos, yPos]In my mind that should be working. But it’s not. Haha. I’m getting an error that says: “Error at line 2 in property ‘Position’ of layer 3 (‘S1’) in comp ‘Positions Test_001’. Illegal use of reserved word., an expression was disabled as a result of an error.
Anyone got any ideas? It’d be greatly appreciated. Thank you!!!