Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Index Opacity Expression

  • Index Opacity Expression

    Posted by Mike Mackenzie on March 10, 2020 at 3:12 pm

    Hi everyone…
    Is there a way to create an expression, probably using either a Layer Control or Slider Control, that will allow me to solo or otherwise show only an individual layer of a comp? For example, let’s say I have a precomp where every layer is the image of a different car. I’d like to drop this precomp into a main comp, but have the ability within the main comp to select a single layer of the precomp so that it shows only a single car in the main comp. My guess is some combination of index and opacity, but my expression game is pretty weak and I have no idea how to do this.
    Ultimately I want to create a template using Master Properties so I can version out a ton of car ads, and something like this would really save me a ton of work.
    I feel like I have seen this functionality online before, but now that I need it I cannot find it or figure out how to write it myself.
    Any help is greatly appreciated!

    Motion Graphics Designer / Art Director
    Boston, MA

    Mike Mackenzie replied 6 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Tomas Bumbulevičius

    March 10, 2020 at 6:15 pm

    Hey Mike,

    this is pretty easy to accomplish.

    1. Put all ‘cars’ in a composition called ‘all-cars-comp’
    2. Put this ‘all-cars-comp’ into your ‘main’ master comp.
    3. Add slider control to this layer.
    4. Apply the following expression to every ‘car’ layer’s opacity, in ‘all-cars-comp’
    selectedIndex = comp("main").layer("all-cars-comp").effect("Slider Control")(1);
    carIndex = index;

    if (selectedIndex == carIndex){
    100
    }else{
    0
    }

    5. Change slider values and thats it! 🙂

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.
    Boxer – Dynamic Text Boxes Template with a Live Preview

  • Mike Mackenzie

    March 10, 2020 at 6:31 pm

    That is pretty much exactly what I was hoping for, thank you so much!

    Motion Graphics Designer / Art Director
    Boston, MA

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