Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Display array in text source

  • Display array in text source

  • Clement Dubois

    October 7, 2021 at 1:29 pm


    I don’t know if it’s possible, but I want to display selected array properties in multiples text source.

    The idea is to paste mutiples numbers in an array, for exemple : [75, 60, 40]

    And in 3 text layers, select which one will be displayed.

    I could do it manually but, I need to do it for 20 text layers, so I wonder if it can be automatic.


  • Dan Ebberts

    October 7, 2021 at 9:49 pm

    I’m not sure at all if this is what you’re asking, but if you want a layer’s visibility to be driven by an array, you could use an opacity expression like this:

    array = [75, 60, 40];

    array.indexOf(index) > -1 ? 100 : 0

    and then only layers 40, 60, and 75 would be visible. (Note that this requires the JavaScript expression engine).

    If that’s not what you’re after, please provide more detail.

  • Clement Dubois

    October 8, 2021 at 7:37 am

    Thanks Dan,

    I’ll be more specific about my project.

    I’m working on a ranking system, so I wonder if it’s possible to write each points of each teams in a text source with an array, and pick the array value we want to display to text layer one by one ?

  • Dan Ebberts

    October 8, 2021 at 12:51 pm

    Ah, OK. Each of your points layers would need an expression something like this:

    txt = thisComp.layer("text with all data").text.sourceText;

    myIdx = parseInt(name.split("_")[1],10)-1;


    This assumes that the points layer’s name is in the format you’ve shown: “team.points_n”, where “n” minus 1 becomes the index into the array.

  • Clement Dubois

    October 8, 2021 at 2:30 pm

    Thanks for your reply.

    I pasted the expression, and try few things but nothing worked.

    my layer “team.points_1” shows nothing.

    Also I’m starting to learn Ae expression so I don’t understand “parseInt” and “eval”… 😅

  • Dan Ebberts

    October 8, 2021 at 8:44 pm

    Hard to say what’s wrong without seeing your project. The expression did work for me when I set it up though.

Viewing 1 - 6 of 6 posts

Log in to reply.

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