-
Problem with linking correct layer.pos to pos/scale of above layer
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!!
10440_automaticposmask.aep.zip// --- Maskenebenea = thisComp.layer(index-1);
//--- Y ----
h = a.height;
sh = a.transform.scale[1];
aph = a.anchorPoint[1];
aph2 = (h/2) - (aph*-1);maskh = (h*sh/100);
masky = (a.transform.position[1]) - aph2;thisy = masky + (maskh/2);
//--- X ----
w = a.width;
sw = a.transform.scale[0];
apw = a.anchorPoint[0];
apw2 = (w/2) - (apw*-1);maskw = (w*sw/100);
maskx = (a.transform.position[0]) - apw2;thisx = (maskx + (maskw/2)) + effect("Slider X")("Slider");
[thisx, thisy]