FORUMS: list search recent posts

# Problem with linking correct layer.pos to pos/scale of above layer

FAQ   •   VIEW ALL
 Problem with linking correct layer.pos to pos/scale of above layer on Aug 19, 2016 at 4:23:52 pm

Hi,

i wrote an expression to link the (center)position of layer 2 to the center of layer 1. Depending on position and scale of layer 1. That works pretty good as long as the anchorpoint of layer 1 is a negative value – f.e. on the top/left corner.

What do i have to write to get this script working, independently from the position of the anchor point of layer 1?

Thx!!

Btw. Take a look at the AE-File attached!!

a = thisComp.layer(index-1);

//--- Y ----

h = a.height;
sh = a.transform.scale[1];
aph = a.anchorPoint[1];
aph2 = (h/2) - (aph*-1);

//--- X ----

w = a.width;
sw = a.transform.scale[0];
apw = a.anchorPoint[0];
apw2 = (w/2) - (apw*-1);

[thisx, thisy]

 Re: Problem with linking correct layer.pos to pos/scale of above layeron Aug 19, 2016 at 5:17:50 pm

Like this maybe:

a = thisComp.layer(index - 1);
p1 = a.toComp([a.width,a.height]/2);
p2 = toComp([width,height]/2);
value - (p2 - p1)

Dan

 Re: Problem with linking correct layer.pos to pos/scale of above layeron Aug 20, 2016 at 9:48:14 am

Thx for the Replay, but it too does only work if the Anchor Point is from zero to negativ.
As soon as the AP-Value is positiv it stops working.

Cheers

 Re: Problem with linking correct layer.pos to pos/scale of above layeron Aug 20, 2016 at 8:53:29 pm

I must not understand what you're trying to do, because for me, the expression will track the center of layer 1 no matter where its anchor point is.

Dan

 Re: Problem with linking correct layer.pos to pos/scale of above layeron Aug 22, 2016 at 7:57:21 am

Mmmh ... did you use Scale on layer 1? Because that is when it brakes the solution for me.
Can u upload a AE-Example? Maybe i do something else wrong.

Thx a lot anyway!!

 Re: Problem with linking correct layer.pos to pos/scale of above layeron Aug 22, 2016 at 10:03:41 am

Hey Dan, i have to correct my previous post. You are 100% right. It works pretty fine and in just 4 lines! Amazing!

The problem was, that we use the (awesome) Motion-Plugin from Mt. Mograph and if you animate scale plus position and then reposition the AP with his plugin, theeeeen (i don't know why, but) it turn into motion from hell ;)