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 pmI’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 pmsomething 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 framesendT = 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 pmthat’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 pmactually 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 pmoh 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 pmto 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
Reply to this Discussion! Login or Sign Up