Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › How to define sequence of layers from max to min

  • How to define sequence of layers from max to min

    Posted by Serge Druz on July 5, 2017 at 8:32 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.

    Serge Druz replied 9 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    July 5, 2017 at 9:09 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

  • Serge Druz

    July 5, 2017 at 9:33 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.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy