Copy link to clipboard
Copied
Hi !
I use several expressions of Dan Ebberts to have an autoscale text:
Anchor point :
sourceSize = thisLayer.sourceRectAtTime(time, false);
T = sourceSize.top;
L = sourceSize.left;
W = sourceSize.width;
H = sourceSize.height;
([L+ W/2,T+H/2])
Size :
maxW = thisComp.width*0.9;
maxH = thisComp.height*0.45;
r = sourceRectAtTime(time);
w = r.width;
h = r.height;
s = w/h > maxW/maxH ? maxW/w : maxH/h;
[100,100]*s
It works great, the problem is that I have several text layers and I would like the position of the layer below to move according to the height of the text above. They must not overlap and move keeping the same distance between them.
I tried using the following expression on the position of my bottom layer:
st = thisComp.layer("P1");
sh = st.sourceRectAtTime().height;
tp = st.position;
np = [value[0], tp[1] + sh]
Unfortunately, as the top layer has a scale that varies due to autoscale, the position is not well calculated.
How could I solve my problem?
Thank you in advance for your help.
Copy link to clipboard
Copied
This is something you can't solve satisfyingly this way. It's not a flaw in the code, it's an inherent limitation in how AE evaluates expressions. In order to have everything update properly, you'd have to do al lthe calculations in one expressions and then just re-use the values on the layers. You would create an invisible dummy layer somewhere and then have the expression on its properties and/ or a custom expression control, then link the layers. This by itself enforces a different processing order in the expressions and should update everything correctly.
Mylenium