-
How can I get number of lines of a text layer if the source text is variable?
I’m new to AE scripts, so excuse my lack of knowledge.
The expression I’m using to calculate number of lines is;
L = thisLayer; var newStyle = L.text.sourceText.style; var myLeading = newStyle.autoLeading ? newStyle.fontSize * 1.2 : newStyle.leading;
H = L.sourceRectAtTime(time, false).height;
rowNo = Math.ceil(H / myLeading);
which I found from Andrei Popa’s answer for this discussion.
The expression works fine when the source text doesn’t change, but when I insert keyframes to source text to change it, the script just calculates the number of lines based on the first keyframe and stays the same for all frames. Is this the normal behavior? What else can I try to achieve this?