View all expressions
Interpolation

Row Counter for Text Layers

Counts the number of rows in a text layer, adjusting dynamically based on font size and leading (line spacing).

Contributed by:


L = thisComp.layer("textLayer");
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);
rowNo;

Row Counter for Text Layers

Practical use case

Great for automating layouts where the number of text rows affects the design, such as captions, paragraphs, or dynamic subtitles.

Check out similar expressions

Data-driven video workflows for After Effects are easier with Plainly.

a mesh of elegant lines transparent image