Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Enable/Disable a layer’s effects with expressions(checkbox)

  • Enable/Disable a layer’s effects with expressions(checkbox)

    Posted by Marc Walker on July 4, 2015 at 5:54 pm

    First of all, I want to apologise if this question is too simple or has been asked before(if it has, I could’nt find it).

    I am quite new to AE and the expression language, and what you can and cannot do with it.

    So…

    I have a text layer with the effect “Bad TV Old” applied to it.

    I want to be able to switch this effect on and off with a checkbox and therefore, with keyframes.

    I have added a checkbox expression(effect) and attempted to add some expression script to enable and disable each effect in the layer.

    Is this even possible? I have searched for examples and info, but can’t find any for the methods I need. The effects have no properties like “Opacity”, that I can manipulate to get an on/off effect(e.g.”Wave Warp”). The kind of code i feel comes to mind is something like the following(as you can probably see, I’m used to C#):

    _checkBox = effect("Enable Effects")("Checkbox");
    if (_checkBox.value == 1)
    {
    thisLayer.effects.enabled = true;
    }
    else
    {
    thisLayer.effects.enabled = false;
    }

    or

    _checkBox = effect("Enable Effects")("Checkbox");
    if (_checkBox.value == 1)
    {
    thisLayer.effect("Wave Warp").enabled = true;
    }
    else
    {
    thisLayer.effect("Wave Warp").enabled = false;
    }

    Marc Walker replied 10 years, 10 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    July 4, 2015 at 7:20 pm

    Each effect will need its own expression. I think as of AE CC 2014, all the effects now have Compositing Options, which include Effect Opacity, which you should be able to tie to your checkbox control like this:

    _checkBox = effect(“Enable Effects”)(“Checkbox”);
    if (_checkBox.value) 100 else 0

    Dan

  • Marc Walker

    July 5, 2015 at 4:20 pm

    Hi Dan,
    Thanks for your answer, but it’s CS6 and there is no compositing option for the effects.

    However, you did point me in the right direction; I researched the compositing effects option and found that the outcome is similar to the “Blend with original”(“Blend”) effect, which I then applied to the layer. I can now control the effects on/off with the 0-100% slider which I can control with keyframes.

    I wonder if you help me with one more thing, Dan?
    Everything was ok for the first few hours, then all of a sudden the text moved to the top-left corner, with the container still centre!(‘undo’ does nothing)
    If I disable the Blend effect, it moves back to centre.

    The “Blend” properties are:
    Blend with Layer : [5.Text Layer(this)]
    Mode : [Crossfade]
    Blend with Original : [0.0%]
    If Layer Sizes Differ: [Centre] (or [Stretch to Fit])

    Do you have any insight into this problem?
    Thanks

  • Dan Ebberts

    July 5, 2015 at 5:38 pm

    Sorry, I have no idea. I don’t think I’ve ever used the Blend effect, so I’m not sure what the issue could be.

    Dan

  • Marc Walker

    July 5, 2015 at 9:34 pm

    Ok thanks Dan, I reloaded the project and its back centered. Must be a bug or something.

    All Sorted. Thanks for your help.

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