ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Linking slider amount to index

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Matt Newt
Linking slider amount to index
on Mar 11, 2019 at 2:35:15 am

I may have an impossible question. I have a very simple expression to control the visibility of layer duplicates using a slider. The null layer with the slider is layer #1, hence the "index-1" in the expression.

slider=thisComp.layer("controls").effect("Number of Duplicates")("Slider")

if(slider>=index-1){100}
else{0}


So...say I wanted to add another layer at the top. Is it possible to make it so regardless of what the index numbers are, the number of layers at 100 % opacity will match the slider amount? I'm not sure if using "index" will even work, or if maybe there's another condition I could add to the expression?

I also realize I could just move the null below the other layers or to another comp entirely, but honestly I just want to know if this is possible. I'm new to expressions so it's interesting to learn new ways of doing things.

Thanks!


Return to posts index

Kalleheikki Kannisto
Re: Linking slider amount to index
on Mar 11, 2019 at 4:25:45 pm

From what I can tell, your code should work for that just fine, making the top X layers transparent (as long as the expression is applied to the transparency in every one of them), skipping -- or including -- the controls layer, since you're actually including (slider value + 1) layers into it. Or is it not doing that?

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

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