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")
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.
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?