Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Parent to Z position only with offset

  • Parent to Z position only with offset

    Posted by Deniz Nasif on October 2, 2013 at 4:08 pm

    Hi,

    I currently have a load of squares which I want to animate along the z axis with an offset in the animation time for each layer.

    I am currently parenting them all to one layer and I can get them all to follow in sequence, but i can’t get them to parent along the z axis only. I want each square to keep its own unique x and y position. The expression I am currently using is below.

    Any help in this would be greatly appreciated.

    Many thanks.

    offset = -.2; //The offset in time, negative 0.2 secs.
    p = thisComp.layer("My parent layer"); //The parent layer
    t = time + offset * index; //The current time minus offset time multiplied by layers in comp
    p.position.valueAtTime(t); //Value of the parent's position property at the current time minus offset time

    vanessa st pier replied 5 years, 4 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    October 2, 2013 at 4:24 pm

    Try replacing the last line with this:

    z = p.position.valueAtTime(t)[2];
    [value[0],value[1],z]

    Dan

  • Deniz Nasif

    October 2, 2013 at 4:48 pm

    Dan, you are THE MAN!!!!

    Worked brilliantly.

    THANK YOU.

  • vanessa st pier

    January 28, 2021 at 4:40 pm

    Hey I’m wondering how you pulled this one off? I have upwards of 200 layers and want to avoid individually plugging the expression into each position property. Is there a way to do them all at once?

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