ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Toggle layer's Opacity On/Off using a Checkbox

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mervin James
Toggle layer's Opacity On/Off using a Checkbox
on Jan 21, 2019 at 7:30:43 pm
Last Edited By Mervin James on Jan 21, 2019 at 7:32:33 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;


Return to posts index

Dan Ebberts
Re: Toggle layer's Opacity On/Off using a Checkbox
on Jan 21, 2019 at 7:39:32 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



Return to posts index

Alex Printz
Re: Toggle layer's Opacity On/Off using a Checkbox
on Jan 21, 2019 at 7:47:03 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


Return to posts index


Mervin James
Re: Toggle layer's Opacity On/Off using a Checkbox
on Jan 21, 2019 at 8:03:59 pm

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]