Activity › Forums › Adobe After Effects Expressions › Link Current value of parent position to Child layer
-
Link Current value of parent position to Child layer
Posted by Nathaniel Logan on February 17, 2019 at 3:58 amHi guys,
Im working on a character animation, where i need to control the position of the character from a Null layer. Where im trying to use this on a run cycle.
Let me explain with a shape layer for easy understanding,
I have a null layer where the position is keyframed from outside the comp to the center, and the shape layer is parented to the null, also the shape layer can be animated independently.
p = thisComp.layer(“Null 1”).transform.position;
delta = value – p.valueAtTime(0);
p + deltaThe problem im currently facing is, the shape layer is animating from its start point, what i want is the shape layer has to start from the start point of the null layer which is from outside the comp to center.
Can you help me on this pls ☺
Thanks
Much appreciatedNathaniel Logan replied 7 years, 5 months ago 2 Members · 11 Replies -
11 Replies
-
Dan Ebberts
February 17, 2019 at 7:54 amI think you might just need to make a little adjustment:
p = thisComp.layer(“Null 1”).transform.position;
delta = value – valueAtTime(0);
p + deltaDan
-
Nathaniel Logan
February 17, 2019 at 10:35 amHi Dan thanks for quick response ☺
The above expression worked perfectly fine but what i want to achieve is, Attaching a screenshot for reference.
This is almost something similar to How the pickWhip works directly to the parent layer but the problem with pick Whip is need to move the playHead to the last keyframe and then pickWhick the layer so it will act as how i wanted, else the animation will start from its point.
is it possible to do it by script, or any other way to approach this either by using a pointControl or sliderControl to link the keyframes and connect to the shape layer. Let me know your thoughts.
Much appreciated,
Thanks in Advance 🙂 -
Dan Ebberts
February 17, 2019 at 4:18 pmMaybe more like this:
p = thisComp.layer(“Null 1”).transform.position;
t = p.key(p.numKeys).time
delta0 = valueAtTime(0) – p.valueAtTime(t);
delta = value – valueAtTime(0);
p + delta0 + deltaor maybe like this, if you’re not animating the position of the shape layer:
p = thisComp.layer(“Null 1”).transform.position;
t = p.key(p.numKeys).time
delta0 = valueAtTime(0) – p.valueAtTime(t);
p + delta0Dan
-
Nathaniel Logan
February 17, 2019 at 6:14 pmEven miracles takes little time, but your Expressions works like charm ☺ I can’t thank you enough Dan, thank you sooo much ☺ 🙂
-
Nathaniel Logan
February 19, 2019 at 3:40 amHi Dan,
Stuck with a small thing for the same expression:
p = thisComp.layer(“Null 1”).transform.position;
t = p.key(p.numKeys).time
delta0 = valueAtTime(0) – p.valueAtTime(t);
delta = value – valueAtTime(0);
p + delta0 + deltaWas trying to create a marker Name “RunCycle Start” and connect the above script to the marker but i failed on it can you please help me on this is it possible to do so :
I was trying the below script but it doesn’t workif (marker.numKeys > 0 && time > marker.key(“RunCycle Start”).time){
expression
}else{
value
Can you pls help
Thank you so much,
Much Appreciated -
Dan Ebberts
February 19, 2019 at 7:24 amIt’s a little tricky, because it’s hard to picture exactly the sequence of events that should happen…
Dan
-
Nathaniel Logan
February 19, 2019 at 7:27 amHello Dan,
Thanks for quick response.Any other approach will that take to achieve this, please im totally stuck at this point 🙁
-
Nathaniel Logan
February 19, 2019 at 7:54 amSo what im trying to do is, Animate a Character from its initial position which will be a loop, and then pre-comp the Character and connect the character to a null layer which has the position animation from left to center(Later i will also animate the position from right to center as a different animation ) and then I want to use a marker to trigger the Position from left to center.
I did also try using the below script on the Null layer where the position is animated :
L= comp(“MainComp”).layer(“Character Walk”);
p = thisLayer.transform.position.valueAtTime(time-L.marker.key(“CharacterRun In”).time);and then I used this in the position of the Character Walk Layer :
p = thisComp.layer(“Null 1”).transform.position;
delta = value – p.valueAtTime(0);
p + delta;The above expression works perfectly fine but the animation starts from characters initial position which is the center of the comp and moves to the right, instead is it possible to make the animation start from the Null 1 layer initial position which is from left to the center of the comp
Can you help me on this, please 🙂
-
Nathaniel Logan
February 19, 2019 at 8:32 am
Reply to this Discussion! Login or Sign Up

