Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Follow the x position of the layer above.

  • Follow the x position of the layer above.

    Posted by Ranveer Singh on July 18, 2019 at 8:39 am

    Hey there people,

    I am trying to animate a list where I have animated the X position of the top layer and want all the other layer to follow the position of the layer above it. I am using this expression

    x=thisComp.layer(index-1).transform.position[0].valueAtTime(time);
    [x,value[1]]

    but it’s not working. I am getting this error thisComp.layer(index-1).transform.position[0].valueAtTime(time) is not a function.

    x=thisComp.layer(index-1).transform.position[0].valueAtTime(time);
    [x,value[1]]

    Filip Vandueren replied 6 years, 11 months ago 2 Members · 1 Reply
  • 1 Reply
  • Filip Vandueren

    July 18, 2019 at 11:31 am

    You should put the [0] at the end of the first statement.

    Long story:
    As soon as it encountered the [0], the expression did an implicit look up of the value() of transform.position, which returned a 2 or 3 dimensional array, of which it yielded the first [0]thd element.
    Consequently it interpreted the rest of the statement as if you were asking .valueAtTime() of a number, which is not a function, I guess. ☺

    so to recap:
    x=thisComp.layer(index-1).transform.position.valueAtTime(time)[0];
    [x,value[1]]

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