ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How to define sequence of layers from max to min

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Serge Druz
How to define sequence of layers from max to min
on Jul 5, 2017 at 8:32:48 pm

Thank you for all you help.

For example I have 5 circles with random scale.
is there any way to find out, which layer has max value. which second after max value, which third and so on till min layer.
if I find out this i want to make
max layer - 100% opacity
second -80% opacity
third - 60%
fouth - 40%
and fifth - 20%

and then if scale randomly changes, it need to be update automaticly.

I don't even know if it possible, but I will be grateful for any help.
Thank you.


Return to posts index

Dan Ebberts
Re: How to define sequence of layers from max to min
on Jul 5, 2017 at 9:09:45 pm

Assuming the layers are the top 5 layers in the stack, something like this might work:


s = scale[0];
vals = [20,40,60,80,100];
count = 0;
for (i = 1; i <= 5; i++){
if (index == i) continue;
if (s > thisComp.layer(i).scale[0]) count++;
}
vals[count]


Dan



Return to posts index

Serge Druz
Re: How to define sequence of layers from max to min
on Jul 5, 2017 at 9:33:54 pm

Unfortunately I don't understand the code, but it works perfectly. It's a kind of magic. Thank you very much for your help.


Return to posts index

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