-
Switch Case in text layer returns the switch the value, Having to use switch(true)
Created a pseudo effect for a template, with a popup.
And depending on the what is on the popup the sentence should change.
here is the code
sel = thisComp.layer("Control").effect("Carry Forward")("First Message");
switch(sel){
case 1:
"CARRY FORWARD PICK 6" ;
break;case 2:
"CARRY FORWARD PICK 8";
break;case 3:
"CARRY FORWARD PICK 4";
break;
}However though it doesn’t give me any error it ends up with the text displaying the “sel” value.
That is “1”, “2”, or “3” instead of the sentence.I also tried to put
value = “….” in the cases
same resultsSearching the web I saw something about a switch using “true” instead of a variable, this one worked:
sel = thisComp.layer("Control").effect("Carry Forward")("First Message");
switch(true){
case (sel ==1):
"CARRY FORWARD PICK 6" ;
break;case (sel == 2):
"CARRY FORWARD PICK 8";
break;case (sel == 3):
"CARRY FORWARD PICK 4";
break;
}Any idea why the first one didn’t work, shouldn’t it have the same results?