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 to make an array available to other layers via expressions

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

    Posted by Arne Münch on January 24, 2013 at 2:29 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

    Dan Ebberts replied 13 years, 6 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    January 24, 2013 at 3:01 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

  • Arne Münch

    January 24, 2013 at 4:07 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?

  • Dan Ebberts

    January 24, 2013 at 4:13 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

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