ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Index Opacity Expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mike MacKenzie
Index Opacity Expression
on Mar 10, 2020 at 3:12:41 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


Return to posts index

Tomas Bumbulevičius
Re: Index Opacity Expression
on Mar 10, 2020 at 6:15:22 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


Return to posts index

Mike MacKenzie
Re: Index Opacity Expression
on Mar 10, 2020 at 6:31:06 pm

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

Motion Graphics Designer / Art Director
Boston, MA


Return to posts index

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