ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Follow the x position of the layer above.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ranveer Singh
Follow the x position of the layer above.
on Jul 18, 2019 at 8:39:54 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]]


Return to posts index

Filip Vandueren
Re: Follow the x position of the layer above.
on Jul 18, 2019 at 11:31:18 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]]




Return to posts index

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