Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Automate Numbers

  • Posted by Shashank Raghu on November 20, 2020 at 5:31 pm

    Hello,

    I’m trying to automate the number where if I disable one number layer another number has to continue from the previous one.

    for example – there are 10 text layers which contain 1 to 10 in order, if I disable the 5th layer(which is “5”) the 6th layer has to change to “5” and the 7th layer has to change to “6” and so on.

    I tried

    n = [];

    if(thisComp.layer(index+1).enabled = true){
    parseInt(thisComp.layer(index + 1).text.sourceText) + 1;
    } else {
    for (i = index; i < (thisComp.numLayers); i++){
    if(thisComp.layer(index+1).enabled = true){
    break;
    }
    n[i] = parseInt(thisComp.layer(i+1).text.sourceText) + 1;
    };
    };

    but it is not working when I disable the layer.

    Shashank Raghu replied 5 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    November 20, 2020 at 6:34 pm

    Something like this should work:

    n = 10; // number of layers participating

    count = 0;

    for (i = 1; i <= Math.min(thisComp.numLayers,n); i++){

    if (thisComp.layer(i).enabled) count++;

    if (i >= index) break;

    }

    count

  • Shashank Raghu

    November 20, 2020 at 6:57 pm

    Yeah, it is working, thanks a lot.

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