Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Conditional expression problem

  • Conditional expression problem

    Posted by Sntsnt on December 8, 2005 at 1:24 pm

    I’m trying to make a kind of a toggle from a null object that would switch on or off various layers in various compositions. When the Video switch (the eye symbol) of the null object would be turned on, the opacity of the linked layers would be turned 100. And when the Video switch of the null object would be turned off, the opacity of the linked layers would be turned to 0.

    I’m a complete novice with AE’s expressions and I just can’t make this work. Maybe there’s something wrong with the syntax? Maybe I’ve misunderstood the way the “.active” attribute works.

    This is what I came up with:

    TOGGLE = comp(“ToggleComp”).layer(“NullObject”).active;
    if TOGGLE = true 100 else 0

    sam

    Mylenium replied 20 years, 9 months ago 3 Members · 5 Replies
  • 5 Replies
  • Mylenium

    December 8, 2005 at 4:40 pm

    You can use the .active property, but it’s not the best solution. I would create a custom checkbox control on your dummy layer – this is much cleaner, especially in case you decide to add more custom controls later on. You could attach them all to this one layer instead of cluttering your timeline with multiple Null objects. Other than that, you should learn what brackets are for… Your expression does not work because there is no separation between the condition and the actual function. It should like that:

    TOGGLE = comp(“ToggleComp”).layer(“NullObject”).active;
    if (TOGGLE = 1){100}
    else {0};

    For reasons of efficiency I replaced “true” with “1”.

    Mylenium

    [Pour Myl

  • Dan Ebberts

    December 8, 2005 at 8:56 pm

    Close – the equality test uses the double equal sign – like this:

    if (TOGGLE == true) 100 else 0

    Dan

  • Sntsnt

    December 9, 2005 at 10:54 am

    Great, now it works, thanks a lot! 🙂

    The After Effects User Guide doesn’t seem to say anything on the subject of conditional expressions. I suppose I should get one of those more in-depth tutorial books to get properly started with the expressions. Seems to be a quite powerful feature.

    sam

  • Sntsnt

    December 9, 2005 at 11:06 am

    Ok, the checkbox control seems like a good idea.

    The reason I was thinking of using the Video switch is that the finalized project is going to be used for a tv show on a weekly basis by more or less inexperienced After Effects users, ie. the video editors of the show. I’m trying to prepare the project so that it’s going to be very simple to add or remove pre-animated objects to the graphics by simple toggle switches. And the Video switch with its eye-symbol couldn’t be more clearer to use.

    sam

  • Mylenium

    December 9, 2005 at 7:57 pm

    [Dan Ebberts] “Close – the equality test uses the double equal sign – like this:

    if (TOGGLE == true) 100 else 0

    Dan”

    Ooops, how could I have overlooked that! It’s so good to have you around, Dan.

    Cheers

    Mylenium

    [Pour Myl

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