Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Add values to an empty array

  • Add values to an empty array

  • Padraic Rapp

    November 25, 2019 at 3:16 pm

    Hey ya’ll !
    I am trying to create a shape layer path based on a target layer’s position.
    this expression:
    createPath(points = myPoints, inTangents = [], outTangents = [], isClosed = false);
    lets me create a path based on an input array (“myPoints”).

    I want this array to be dynamic for a lack of a better term ( I am no programmer), i.e. I want to add values to this array and I thought I could use something like this:

    tCount = 0; // time counter
    tInter = 0.5; // time interval (samples)
    myPoints = []; //an empty array to store the path points

    while(tCount

    The first line in the while loop returns an error ("Undefined value used in expression"). I thought I could add values to an empty array but I guess I'm doing something wrong. Can somebody help me out with this? How DO you add values to an array? Or should I be generating a string inside the "myPoints" array that contains all the points based on a similar while loop?

    Any help is greatly appreciated!
    Thanks

  • Dan Ebberts

    November 25, 2019 at 5:00 pm

    The easiest way would be to use push(), like this:

    myPoints.push(thisComp.layer(“target”).transform.position.valueAtTime(tCount));

    Dan

  • Padraic Rapp

    November 26, 2019 at 7:41 am

    YES! works perfectly. Thank you so much Dan!

Viewing 1 - 3 of 3 posts

Log in to reply.

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