Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is it possible for an expression to iteratively build numbered arrays via loop?

  • Is it possible for an expression to iteratively build numbered arrays via loop?

    Posted by Teague Chrystie on February 21, 2018 at 6:06 pm

    Hey folks, hope all is well. I’m hoping to figure out how to automatically kick out a bunch of numbered arrays, like this:

    arrayNumber1 = [];
    arrayNumber2 = [];
    arrayNumber3 = [];
    arrayNumber4 = [];
    arrayNumber5 = [];

    arrayNumber99 = [];
    etc.

    My initial knowledge of Javascript came from programming Arduino boards, and in Arduino I’m pretty sure (though not positive) I’ve been able to get this kind of thing to happen; having tried several approaches to get there in After Effects, though, I’m coming up short. Is it just not possible in this ecosystem, or is my ignorance showing? Any ideas?

    Thanks folks.

    Dan Ebberts replied 8 years, 2 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    February 21, 2018 at 7:04 pm

    What is it you’re trying to do exactly? It’s hard to tell from your description if you’re running into one of the inherent limitations of expressions (no persistent variables, no way to share data outside the expression except by manipulating the value of the property hosting the expression, etc.)

    Dan

  • Teague Chrystie

    February 21, 2018 at 7:48 pm

    Thanks for the quick reply, Dan. I can’t tell you how many of your previous posts have been the Google result that helped me out with something.

    Anyway, what I’d love to have happen is something like this:

    numArrays = [some number];
    defaultArrayName = “arrayNumber”;

    for(i = 0; i < numArrays; i++){
    var (defaultArrayName + i) = new Array();
    }

    Obviously what I’ve written above doesn’t work, but hopefully it communicates the idea: a loop that makes numbered arrays. Thoughts?

  • Teague Chrystie

    February 21, 2018 at 7:50 pm

    (To be clear: within the context of a single expression, I need a bunch of arrays.)

  • Dan Ebberts

    February 21, 2018 at 8:01 pm

    The closest I can think of would be to create an array of arrays:

    myArray = [];
    numArrays = 5;

    for(i = 0; i < numArrays; i++){
    myArray[i] = [];
    }

    They wouldn’t be named, but you could access them easily by index.

    Dan

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