ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

how to get 'actual' width of a text layer.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jamie Bradshaw
how to get 'actual' width of a text layer.
on Feb 10, 2008 at 9:01:17 pm

Is 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,
Jamie


Return to posts index

Dan Ebberts
Re: how to get 'actual' width of a text layer.
on Feb 10, 2008 at 9:19:08 pm

You can do it with scripting, but not expressions.

Dan



Return to posts index

Jamie Bradshaw
Re: how to get 'actual' width of a text layer.
on Feb 11, 2008 at 10:18:07 am

Ah okay, thanks Dan.

I haven't had much dealing much with scripting. Would this be a difficult thing to do?




Return to posts index


Dan Ebberts
Re: how to get 'actual' width of a text layer.
on Feb 11, 2008 at 1:20:56 pm

Not 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



Return to posts index

Lloyd Alvarez
Re: how to get 'actual' width of a text layer.
on Feb 11, 2008 at 2:49:30 pm

Actually 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



Return to posts index

Jamie Bradshaw
Re: how to get 'actual' width of a text layer.
on Feb 11, 2008 at 2:55:25 pm

Thanks 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



Return to posts index


Dan Ebberts
Re: how to get 'actual' width of a text layer.
on Feb 11, 2008 at 2:55:28 pm

Yeah, 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



Return to posts index

Jan Vork
Re: how to get 'actual' width of a text layer.
on Jul 3, 2017 at 11:03:17 am

Try this:

‚Äč
x=thisComp.layer("nameofthelayer").sourceRectAtTime().width;

x=thisComp.layer("nameofthelayer").sourceRectAtTime().width;

http://www.jaydude.nl


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]