Copy link to clipboard
Copied
I have searched high and wide and can't seem to find an answer. Maybe I'm just tired. I need to check to see if there is a slider with a specific name on the layer above the current layer and then return a default value if the slider does not exist. I thought this approach would work, but it throws an error.
if(thisComp.layer(index - 1).effect("Line Spacing")("Slider") == null)
lineGap = 0
else
lineGap = thisComp.layer(index - 1).effect("Line Spacing")("Slider");
There must be a way to check to see if there is an effect added to another layer. If I add a slider named Line Spacing to the layer above and change the == from null to 100 then the conditional statement works, the lineGap matches the slider value until it reaches 100 then drops to zero.
If anyone knows the answer it's Dan_Ebberts. I hope I'm missing something simple.
This should work:
try{
lineGap = thisComp.layer(index - 1).effect("Line Spacing")("Slider");
}catch(e){
lineGap = 0;
}
Dan
Copy link to clipboard
Copied
This should work:
try{
lineGap = thisComp.layer(index - 1).effect("Line Spacing")("Slider");
}catch(e){
lineGap = 0;
}
Dan
Copy link to clipboard
Copied
Perfect Dan. Thanks. It's now in my expression bible...