ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Layer height confusion

FAQ   •   VIEW ALL
 Layer height confusion on Aug 9, 2018 at 10:18:34 pm

Long story short: I have a comp with two independent text layers (let's call it A) nested into a second comp (B). I have a third precomp (C) with an expression using sourceRectAtTime to get the height of the two text layers in A. Say I have A parked in B with the top of the top line of text sitting at 217Y, and sourceRect says the height of that text layer is 117. I would think that would put the bottom of the top line at 334Y. But using a null lined up with the bottom of the text, it's closer to 280Y. And as I scale the text layers in A with connected sliders, the problem magnifies.

End result: I'm trying to get the top of the text in C to maintain its distance from the bottom of the text in A as the text layers shrink and grow. I have the two text layers interacting properly within A (bottom line moves up/down as top line shrinks/grows) but I can't get this last bit and I can't start building the rest of the project without this last piece of framework. Can someone explain this? I'd love to understand the why of the math working the way it is, because it seems to defy logic.

---
It is easier to destroy than to create.
More fun, too.

 Re: Layer height confusionon Aug 9, 2018 at 11:02:22 pm

Something like this should give you y coordinate of bottom of a text layer:

L = comp("A").layer("top text");
r = L.sourceRectAtTime(time,false);
b = L.toComp([r.left,r.top+r.height])[1];

Dan

 Re: Layer height confusionon Aug 10, 2018 at 1:45:34 pm

[looks at his ineffective 25 lines of code
looks at Mr. Ebberts' working 3 lines of code
weeps]

Doesn't do exactly what I need but gets me enough of the way there I can probably puzzle out the rest. Knew I should have paid attention in Algebra class.

Thank you much! Very appreciated.

---
It is easier to destroy than to create.
More fun, too.