FORUMS: list search recent posts

Is it possible to make an array available to other layers via expressions

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
leif falk
Is it possible to make an array available to other layers via expressions
on Jan 24, 2013 at 2:29:31 pm

Hi everybody
I have written an expression to write an array of non repeating values lets say from 1 to 20 into an array like in the attached code (Put this to an expression slider control)

It works pretty well. But how you can see, the only possibility I saw for saving these values and make them accessible was by connecting each value to a specific frame in the time line("my_array[t];" access it via the "valueAtTime" expression)
But this can lead to very long expression calculation times, because every frame has to calculate all the calculations from scratch.
Is there a way, other layers can link to specific values of a more than 4 dimensions array via expressions directly.
Something like:
thisComp.layer("Null 1").effect("Slider Control")("Slider").var(my_array[5]);

Hope this is clear enough. Otherwise please ask.

thanks so much.


tot = 20;
t = timeToFrames(time);
pool =[];
my_array = [];

if (t<1||t>tot){123456}else{
seedRandom(1,true);
for (i=0;i<tot;i++)
{pool[i] = i;}
for (i=1;i<tot+1;i++)
{a = Math.floor(random(pool.length));
my_array[i] = pool[a];
pool.splice(a,1);
}
my_array[t]+1 ;
}


Return to posts index

Dan Ebberts
Re: Is it possible to make an array available to other layers via expressions
on Jan 24, 2013 at 3:01:10 pm

I think the closest you can come would be to create an expression on a text layer that creates the array as, for example, comma-separated text. Then your receiving expression retrieves the text string, does a .split(",") to break the text into an array of strings, and then a parseInt() to convert the desired element to a number. I don't know if the performance would be any better that what you have though.

Dan



Return to posts index

leif falk
Re: Is it possible to make an array available to other layers via expressions
on Jan 24, 2013 at 4:07:52 pm

Hallo Dan

thanks for your reply, I tested your way and the performance seems in fact to be even worse.

That means that long arrays are not meant to be stored and accessible via expressions in a proper way, arenĀ“t they?


Return to posts index


Dan Ebberts
Re: Is it possible to make an array available to other layers via expressions
on Jan 24, 2013 at 4:13:59 pm

That's correct. Expressions can't really store anything and can only communicate with other expressions via the calculated value of the property hosting the expression.


Dan



Return to posts index

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