ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Teague Chrystie
Is it possible for an expression to iteratively build numbered arrays via loop?
on Feb 21, 2018 at 6:06:29 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.


Return to posts index

Dan Ebberts
Re: Is it possible for an expression to iteratively build numbered arrays via loop?
on Feb 21, 2018 at 7:04:08 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



Return to posts index

Teague Chrystie
Re: Is it possible for an expression to iteratively build numbered arrays via loop?
on Feb 21, 2018 at 7:48:31 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?


Return to posts index


Teague Chrystie
Re: Is it possible for an expression to iteratively build numbered arrays via loop?
on Feb 21, 2018 at 7:50:35 pm

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


Return to posts index

Dan Ebberts
Re: Is it possible for an expression to iteratively build numbered arrays via loop?
on Feb 21, 2018 at 8:01:13 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



Return to posts index

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