Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Morph position between two parents

  • Morph position between two parents

    Posted by Navarro Parker on November 18, 2013 at 8:57 pm

    I’m looking for a way to have layer A “parented” to Layer B for a certain amount of time, then blend its position to Layer C over the course of 10 frames so Layer C is now the new parent.

    Kevin Camp replied 12 years, 9 months ago 3 Members · 5 Replies
  • 5 Replies
  • Kevin Camp

    November 18, 2013 at 11:04 pm

    something like this would work for position:

    target1 = thisComp.layer("Null 1");
    target2 = thisComp.layer("Null 2");
    startT = 5; // value in seconds
    morphDur = 10; // value in frames

    endT = startT+(morphDur*thisComp.frameDuration);
    if (time < startT) target1.position;
    else if (time > endT) target2.position;
    else linear(time,startT,endT,target1.position,target2.position);

    change target variables to your ‘parent’ layers, set the start time value and morph duration as needed.

    if you needed other properties, like rotation, etc, to be linked, then you’d need to modify the expression for each property needed.

    to ease between parents change ‘linear’ to ‘ease’ in the last line

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Jason Jantzen

    November 20, 2013 at 6:54 pm

    that’s pretty cool, but I can’t seem to figure out why the expression makes the child layer jump. It starts out in the same position as the parent, then when I set the expression, it jumps off to the lower right. When I move the parent around, the child appears to move exponentially as well. Any thoughts on what’s going on there?

    Jason Jantzen
    vimeo.com/jasonj

  • Kevin Camp

    November 20, 2013 at 8:41 pm

    actually you wouldn’t want to use true parenting, the expression will simply take the position value from one layer, and then switch to the position of a different layer, but interpolate between the two positions during the transition.

    looking back, i should have stated that my reply. sorry for the confusion.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Jason Jantzen

    November 20, 2013 at 10:00 pm

    oh cool, I see now. How do you ease between targets? I saw the linear expression towards the bottom and I changed that to ease, and it seems ease a bit, but is there a way to easy it more?

    Jason Jantzen
    vimeo.com/jasonj

  • Kevin Camp

    November 22, 2013 at 7:48 pm

    to get a different ease function, you’d need to define your own function…

    i haven’t tried anything like that, but you can check out this post from dan:

    https://forums.creativecow.net/readpost/227/23434

    he creates a cubic ease-in function, but it would take a little work to get it to run with my example…

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

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