Activity › Forums › Adobe After Effects Expressions › how to get ‘actual’ width of a text layer.
-
how to get ‘actual’ width of a text layer.
Posted by Jamie Bradshaw on February 10, 2008 at 9:01 pmIs there an expression that returns the actual width of a text layer?
For example, if you have a text layer, it’l return the actual width of the text, and not the composition width.
I’ve tried:
n = thisLayer.width;
but that doesn’t work.
Many thanks,
JamieJan Vork replied 8 years, 10 months ago 4 Members · 7 Replies -
7 Replies
-
Jamie Bradshaw
February 11, 2008 at 10:18 amAh okay, thanks Dan.
I haven’t had much dealing much with scripting. Would this be a difficult thing to do?
-
Dan Ebberts
February 11, 2008 at 1:20 pmNot really. Here’s a simple snippet that assumes your text layer is layer 1:
var myLayer = app.project.activeItem.layer(1);
var r = myLayer.sourceRectAtTime(0, false);
alert(r.top + ” ” + r.left + ” ” + r.width + ” ” + r.height);The top and left values are relative to the layer’s anchor point.
Dan
-
Lloyd Alvarez
February 11, 2008 at 2:49 pmActually NAB figured out a way to get the size of a text layer in expressions using sampleImage. He posted his expression over at ae nhacers. I don’t think the cow allows posting any ae nhancers urls so just replace [dot] with a .
www[dot]aenhancers[dot]com/viewtopic.php?f=6&t=931
-
Jamie Bradshaw
February 11, 2008 at 2:55 pmThanks Lloyd, I’ll go and check that out. I think picking up the whole concept of scripting might be a little too much for me at this moment in time.
Jamie
-
Dan Ebberts
February 11, 2008 at 2:55 pmYeah, I just saw that. It should work fine. A bit slow maybe, but way better than not being able to do it at all.
Dan
-
Jan Vork
July 3, 2017 at 11:03 amTry this:
x=thisComp.layer(“nameofthelayer”).sourceRectAtTime().width;x=thisComp.layer("nameofthelayer").sourceRectAtTime().width;
Reply to this Discussion! Login or Sign Up