How to Get True Text Layer Size in After Effects

Ukramedia shows a way to get correct text layer size in After Effects with expressions.

SourceRectAtTime is a valuable expression inside of Adobe After Effects. The expression lets you get the width and height of text and shape layers. It’s a great way to set up some dynamic properties that change with the size of the text layer. That is if the text layer’s scale is 100%. If it’s not, the expression doesn’t work as you might think. This new tutorial from Ukramedia shows how you can get the correct text layer size using expressions, even if the source layer isn’t at 100% scale.

The expression compensates for both width and height by adding a couple of extra lines of code:


targetLayer = thisComp.layer(“Layer Name”);

w = targetLayer.sourceRectAtTime().width;

s = targetLayer.transform.scale[0];

p = (s – 100)* .01;

finalSize = w + p * w;




targetLayer = thisComp.layer(“Layer Name”);

h = targetLayer.sourceRectAtTime().height;

s = targetLayer.transform.scale[1];

p = (s – 100)* .01;

finalSize = w + p * h;


Like The Posts on LesterBanks?

Ensure You continue getting the most relevant tutorials, news, insights, and industry techniques by becoming a patron!