Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Parenting Position Retaining Orig Position of Child

  • Parenting Position Retaining Orig Position of Child

    Posted by Drewhalasz on June 8, 2012 at 3:58 pm

    I’ve search for a reference to this specific question for quite a bit of time. I seems rudimentary, but I would love some closure.

    I have to objects on a comp (layer “A” and layer “B”)- I would like to use an expression to parent the position of the one to the other (A as parent, B as child). I’ve been unable to find an expression that does not change the original position of B when entering the expression.

    It either places B directly at the same position as A with this expression

    thisComp.layer(“A”).transform.position

    or displaces B to a different position using this expression

    L = thisComp.layer(“A”);
    fromWorld(L.toWorld(L.thisComp.layer(“A”).position))

    Both of course then allow B to then follow A’s position, but I’m curious if there is a way to have B remain its orig position.

    My work around has been to add +value to the expression and move B back to its orig position.

    Any help would be greatly appreciated.

    Gus Favoreto replied 6 years, 12 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    June 8, 2012 at 7:21 pm

    One way to do it is to add layer B’s current position to the amount that Layer A has moved since time zero:

    p = thisComp.layer(“A”).transform.position;
    value + p – p.valueAtTime(0)

    This won’t do anything until you actually animate layer A’s position though.

    Dan

  • Drewhalasz

    June 9, 2012 at 4:06 am

    Thanks Dan! Works Great!

  • Gus Favoreto

    May 21, 2019 at 4:43 pm

    Thank you Dan! I was looking for this answer for years.
    I am trying to add a delay on this expression but is not working. Should I add at the end on valueAtTime(0)?

    Thank you!
    Gus

  • Dan Ebberts

    May 21, 2019 at 5:41 pm

    It would depend on what you’re doing exactly, but this would be my guess:

    delay = .25;
    p = thisComp.layer(“A”).transform.position;
    value + p.valueAtTime(time-delay) – p.valueAtTime(0)

    Dan

  • Gus Favoreto

    May 21, 2019 at 8:51 pm

    YES! Perfect!

    Thank you Dan!

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