0

I'm trying to make a slider that basically can act as a crossfader between a bunch of different layers (so as the slider goes up, it fades through several layers). This is what I've written, and I'm getting the error "Error: SyntaxError: Unexpected Token )" on the first line and I'm having trouble telling where the problem is. My code:

if(thisComp.layer("Null 1").effect("Slider Control")("Slider") <= 5)
{
    if(thisComp.layer("Null 1").effect("Slider Control")("Slider") <= 2.5)
    {
        out = linear("Null 1").effect("Slider Control")("Slider"), 0, 100, 0, 2.5);
    }
    else
    {
        out = linear("Null 1").effect("Slider Control")("Slider"), 0, 100, 2.5, 5);
        out = 100 - out;
    }
    }
}
else{
    out = 0;
}
out;

Thank you!!

1

The error message is telling you that you've got a stray bracket, so count your brackets and see if the (s match the )s. Spoiler alert: they don't.

I can see two cases: after each linear function call you have a closing bracket after the "Null 1" string that isn't matched by an opening bracket. And "Null 1" on its own is just treated as a string, not a layer, so that's another problem.

I'm assuming you mean thisComp.layer("Null 1") which is a reference to a layer. So

out = linear("Null 1").effect("Slider Control")("Slider"), 0, 100, 0, 2.5);

should be

out = linear(thisComp.layer("Null 1").effect("Slider Control")("Slider"), 0, 100, 0, 2.5);
| improve this answer | |
  • I got it working, thank you! – torako Feb 3 at 8:00
  • Don't thank me, mash that tick button! – stib Mar 4 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.