ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Link Current value of parent position to Child layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nathaniel Logan
Link Current value of parent position to Child layer
on Feb 17, 2019 at 3:58:29 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


Return to posts index

Dan Ebberts
Re: Link Current value of parent position to Child layer
on Feb 17, 2019 at 7:54:33 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



Return to posts index

Nathaniel Logan
Re: Link Current value of parent position to Child layer
on Feb 17, 2019 at 10:35:29 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 :)


Return to posts index


Dan Ebberts
Re: Link Current value of parent position to Child layer
on Feb 17, 2019 at 4:18:59 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



Return to posts index

Nathaniel Logan
Re: Link Current value of parent position to Child layer
on Feb 17, 2019 at 6:14:59 pm

Even miracles takes little time, but your Expressions works like charm ☺ I can't thank you enough Dan, thank you sooo much ☺ :)


Return to posts index

Nathaniel Logan
Re: Link Current value of parent position to Child layer
on Feb 19, 2019 at 3:40:15 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


Return to posts index


Dan Ebberts
Re: Link Current value of parent position to Child layer
on Feb 19, 2019 at 7:24:42 am

It's a little tricky, because it's hard to picture exactly the sequence of events that should happen...

Dan



Return to posts index

Nathaniel Logan
Re: Link Current value of parent position to Child layer
on Feb 19, 2019 at 7:27:20 am

Hello Dan,
Thanks for quick response.

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


Return to posts index

Dan Ebberts
Re: Link Current value of parent position to Child layer
on Feb 19, 2019 at 7:28:50 am

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

Dan



Return to posts index


Nathaniel Logan
Re: Link Current value of parent position to Child layer
on Feb 19, 2019 at 7:54:11 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 :)


Return to posts index

Nathaniel Logan
Re: Link Current value of parent position to Child layer
on Feb 19, 2019 at 8:32:16 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,


Return to posts index

Nathaniel Logan
Re: Link Current value of parent position to Child layer
on Feb 19, 2019 at 9:43:42 am

Hello, Dan any suggestions on this,

Is it possible to use the Point control / Slider control to achieve this?

Please help me with this one. I'm really quite stuck on this :(


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]