Siri and my iPhone are helping me with this answer.
You can apply hue and saturation to your layer. Then you can add an expression to the luminosity value. The expression is very simple. It only requires that you know how many layers you want to use.
If you have 100 layers, and an eight bit composition then each layer must be reduced in luminance by 255÷100. Expressions understand the layer number by using the term index.
The expression looks like this:
(index - 1)*25.5;
Now just duplicate your layer 100 times.
The top one will have a luminance you have 04 Black, the bottom will have a luminance value of 255.
I'll doublecheck this when I get to a computer, but I think it's perfect.
You could also use effects like Fill, Tint, Tritone and operate based on genuine colors. Depends. The math is very much the same as Rick suggested - divide by number of layers and multiply by index.
Thanks! What would you suggest if I already have a comp with 100 layers and I want to globally control the process? It would be great If I could figure out a way to apply the 'divide by index' method once to modify all the layers in the comp.
For example... if it's a 100 layer comp, layer 1 would turn white and layer 100 would be black. Any help or advice would be greatly appreciated... trying to figure out a quick solution to generate a ramp image based on the layer order.
You've gotten a couple of good answers that address the "how" of your question.
Now I have questions for you: Why do you want to do this? What are you trying to accomplish? A simple change in the color of a solid from white to black?
I'm trying to think of a practical use for what you're doing, and I'm drawing a blank.
Ha! Fair enough!
I'm working on a stereoscopic project and I'm looking for a down and dirty way to create a displacement map from a comp that is made up of a bunch of separate layers. In this case it's 2d character animation that is ordered front to back in relation to the comps layer order 1 through 100 (as an example). I want to use the layer order to create a ramp that I could then use to drive the displacement. Your suggestion above works perfectly by the way. Once I've applied it to the first layer, I just copy and paste the effect (with the expression) to the rest of the layers. A null connected to expression controls to modify the 'ramp' globally would be cool! I quickly tried using an adjustment layer with Levels effect which does the trick.
BTW... this forum (and your help) is amazing!!
Glad it helped you out. Marking your quesion answered helps others find answers to similar problems.