Copy link to clipboard
Copied
Hi, I wrote an expression to flip my character's head. I think I have the 2 value of the scale, but it still shows that expression result should be of dimension 2, not1.
Here is my expression:
x = thisComp.layer("C | head").effect("Head_Flip")("Checkbox");
if(x == 0) Scale = [100, 100] if(x == 1) Scale = [-100, 100]
What's the problem?
1 Correct answer
Over complicating and poor formatting. Try this:
if (effect("Checkbox Control")("Checkbox") == 0 ) {value} else [-100, 100]
Copy link to clipboard
Copied
Over complicating and poor formatting. Try this:
if (effect("Checkbox Control")("Checkbox") == 0 ) {value} else [-100, 100]
Copy link to clipboard
Copied
Awesome! Even though I still don't know where is the problem, but your expression works great. Thanks a lot~
Copy link to clipboard
Copied
Don't need Scale - That alone would generate an error. The operator after the if statement needs to be in brackets, just stringing together if statements is sloppy and you are missing the brackets again. Multiple if statements work sometimes but are easy to foul up.
if (condition == something) {do this} else do this
or
if (condition == something) {do this} else if (condition == something else) {do this}
If there is nothing in brackets there is nothing for the if statement to do.
You should spend a little time with the expression language guide in the User Manual. The new engine is even more picky about proper formatting.