Creative Communities of the World Forums

The peer to peer support community for media production professionals.

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 am

    Hi 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 + delta

    The 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 appreciated

    Nathaniel Logan replied 7 years, 5 months ago 2 Members · 11 Replies
  • 11 Replies
  • Dan Ebberts

    February 17, 2019 at 7:54 am

    I think you might just need to make a little adjustment:

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

    Dan

  • Nathaniel Logan

    February 17, 2019 at 10:35 am

    Hi 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 pm

    Maybe 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 + delta

    or 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 + delta0

    Dan

  • Nathaniel Logan

    February 17, 2019 at 6:14 pm

    Even 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 am

    Hi 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 + delta

    Was 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 work

    if (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 am

    It’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 am

    Hello Dan,
    Thanks for quick response.

    Any other approach will that take to achieve this, please im totally stuck at this point 🙁

  • Dan Ebberts

    February 19, 2019 at 7:28 am

    Can you describe the motion you’re trying to achieve?

    Dan

  • Nathaniel Logan

    February 19, 2019 at 7:54 am

    So 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

    For reference Attaching the Screenshot of how I wanted, please help me on this Dan, I really stuck and don’t know how to make this work.

    or is there any other way to approach this please let me know will try that,

Page 1 of 2

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