Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Controlling the opacity of a nested comp from the main comp

  • Controlling the opacity of a nested comp from the main comp

    Posted by Kieren Smith on October 24, 2012 at 3:10 am

    Hey AE Expression Geniuses, I’m using a composition of a car, and the “Car” comp contains an “indicators” comp.

    I have multiple “Main” comps that will be using the “Car” comp.
    What I need to do is be able to change the opacity of the “Indicators” comp from which ever “Main” comp contains the “Car” comp.

    The comps are like so: Main comp> contains car comp> contains indicator comp…

    I want to be using this same “Car” comp in many different “Main” comps…

    So applying the following code to the Opacity of the “Indicator” comp won’t work for me:

    comp("Main").layer("indicator Control").effect("Slider Control")("Slider")

    Is there any way I can create some sort of global variable that can be controlled by a slider in multiple “Main” comps and can change the Opacity of the “Indicator” Comp?

    I think I just explained it several times in that message… Any Way Can this be done?

    Dan Ebberts replied 13 years, 7 months ago 3 Members · 2 Replies
  • 2 Replies
  • Darby Edelen

    October 24, 2012 at 4:51 am

    The only way to control this on a per-main-comp basis would be to keyframe the opacity in the Car comp, apply time remapping in the Main comp to the Car comp and create an expression to transition from the Car comp’s indicator ‘opaque’ to ‘transparent’ state.

    Of course what this means is that you can’t really have other animation in your Car comp as it’s timeline will now be controlled separately in the many Main comps.

    If needed you may be better off splitting the Car comp into separate compositions for this. Moving the Indicator comp from the car comp into the associated Main comps and then parenting the Indicator to the Car comp in that Main comp should probably work in most cases.

    Darby Edelen

  • Dan Ebberts

    October 24, 2012 at 4:52 am

    No, you can’t do it with a single instace of a pre-comp. That’s one of the things about a pre-comp–it gets rendered once. So it can’t be different in one parent comp than it is in another.

    You would have to duplicate the pre-comp in the project bin, then each main comp could have its own copy of the pre-comp. Then with clever naming, expressions in the precomp can figure out which main comp they’re in. For example, an expression in pre-com Car_1 could figure out that Car_1 is nested in Main_1. Something like that.

    Dan

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