Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions “If condition statement” only resulting in one condition

  • “If condition statement” only resulting in one condition

    Posted by Ranveer Singh on September 1, 2021 at 7:06 am

    I’m trying to map the value with a slider between 0 to 100 or 50 to 100 depending on the given condition of if the checkbox is On or Off. But, My “if statement” is only resulting in the checkbox being turned on.
    In my case, it’s only resulting in “Double”

    I’d really appreciate any sort of help. Thanks

    Trent Armstrong replied 4 years, 8 months ago 2 Members · 5 Replies
  • 5 Replies
  • Trent Armstrong

    September 1, 2021 at 12:15 pm

    Would you mind putting your expression in the thread here?

    Thanks!

  • Ranveer Singh

    September 1, 2021 at 12:35 pm

    Sorry, Here’s the expression. I had pasted it earlier but somehow I messed up I guess.

    //variables
    driver=effect(“Animation”)(“Slider”).value;
    Switch=effect(“Double_Head”)(“Checkbox”).value;
    Single = linear(driver,0,100,0,100);
    Double = linear(driver,0,100,50,100);

    //condition
    Switch = 1? Double : Single

  • Trent Armstrong

    September 1, 2021 at 3:17 pm

    Awesome! I think it just came down to using two equal signs to do a comparison instead of resetting the variable.

    Try this out and see if it works for you:

    //condition

    Switch == 1 ? Double : Single

  • Ranveer Singh

    September 1, 2021 at 3:37 pm

    Of course, It had to be this. Thanks a lot. I used a similar statement on another property and don’t know how I missed it here. Damn it.

    Thanks a lot man, you saved me. I was cursing after effects thinking it is some sort of bug. hehe

  • Trent Armstrong

    September 1, 2021 at 4:25 pm

    Haha! It’s always one little thing, right? May After Effects treat you exceedingly well today!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy