Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Toggle layer’s Opacity On/Off using a Checkbox

  • Toggle layer’s Opacity On/Off using a Checkbox

    Posted by Mervin James on January 21, 2019 at 7:30 pm

    So Im trying to turn a layer on and off using this well known expression, in After Effects 2019 and for the hell of it I dont know why it isnt working. It works fine in After Effects 2015 and 2018. So im thinking 2019 has a problem or something. Here is a screenshot below. Any help if appreciated.

    I have also tried using the expresson below also with no luck:

    capture.png

    thisComp.layer("Adjustment Layer 1").effect("Checkbox Control")("Checkbox") ==1)100 else 0;

    Mervin James replied 7 years, 3 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    January 21, 2019 at 7:39 pm

    The new JavaScript expression engine is more strict about the syntax for single-line if/else statements. This should work:

    thisComp.layer(“Adjustment Layer 1”).effect(“Checkbox Control”)(“Checkbox”) == 0){0}else{100};

    Dan

  • Alex Printz

    January 21, 2019 at 7:47 pm

    could do it like a ternary operator as well:

    thisComp.layer("Adjustment Layer 1").effect("Checkbox Control")("Checkbox") == 1 ? 100 : 0;

    Alex Printz
    Mograph Designer

  • Mervin James

    January 21, 2019 at 8:03 pm

    Very thankful for the responses Dan and Alex. Both work flawlessly.

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