ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expressions: Determining width of a text layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jakub Michalski
Expressions: Determining width of a text layer
on Apr 25, 2006 at 7:04:51 am

I was wondering if anyone figured out a way to determine the width of a text layer (in AE 6.0 Pro) via expressions.

The typical layer("name").width property behaves similarly to a comp-sized solid or adjustment layer and returns comp width.

Is there any way to determine actual length of the text itself?


(for those who wonder, I read text dynamically from a separate source and then want to have a rectangle underneath it that scales depending on the length of the word)



Return to posts index

Jakub Michalski
Re: Expressions: Determining width of a text layer
on Apr 25, 2006 at 7:29:25 am

Sorry, by the way I meant AE7Pro :)


Return to posts index

Mylenium
Re: Expressions: Determining width of a text layer
on Apr 25, 2006 at 7:41:33 am

That's not really possible. There is a plugin at http://www.petertorpey.com , but it is tied to a scale animator and requires user intervention (you need to scrub the value to activate the calculation), so it would be useless for automated stups.

Mylenium

[Pour Myl


Return to posts index


harryjf
Re: Expressions: Determining width of a text layer
on Apr 25, 2006 at 3:33:03 pm

I've noticed that Path text has an Information section, including Text Length and Path Length.

I've tried reading this with an expression with no luck.

I tried effect("Path Text")("Information")("Text Length") as well as ("Path Text")("Information/Text Length").

No luck.

Maybe someone else has an idea?




Return to posts index

Dan Ebberts
Re: Expressions: Determining width of a text layer
on Apr 25, 2006 at 3:44:02 pm

You can't get to those with an expression. Sorry.

Dan


Return to posts index

crgreen
Re: Expressions: Determining width of a text layer
on Apr 26, 2006 at 2:23:21 am

Couldn't help posting some arguably useless info on this subject.
Depending on what your doing, that is, how/if you're animating stuff, and what you're animating, there is a kludgey way to get dimensions of text. There are some serious caveats, though, like it doesn't really work as an expression problem unless you use a script. I'm not going to lay out the whole procedure (I'm dang busy right now), but I will say this:

When you do a (in mac language) command-shift-n to a text layer the default mask works as a bounding box for your text. If you plan things out right and animate just layer transformations you're golden as far as the mask giving you dimensions of the text, which you can get the values of using a script. What you do after that can be more script stuff or expression stuff (if you apply those values to an expression-able property). If you animate actual text stuff, you'd have to make new masks for certain frames, then copy that mask shape into a keyframed main one and remove the new mask, then do some sort of script thang. And of course changing things like font and font size after the fact potentially screws the whole thing up.

that is worth exactly two cents, if you ask me.

-CG



Return to posts index


Jakub Michalski
Re: Expressions: Determining width of a text layer
on Apr 26, 2006 at 7:31:25 am

Well, it seems that all the methods that exist are too complex for my client.

I am preparting an automated TV Schedule Line-Up screen, where the client (tv station) can add up to 4 titles/times of the shows and then hit render to see it all in action.

My solution looks like this:



All the layers are locked, the sliders are constrained in vertical position and limited on left and right with linear expression. You need to manually adjust the red marker to the end of the text, but I guess this is the simplest solution.

(The sliders on the right are linked to dynamic text and change hour and minute of the show)

Once the project is complete I may put a case study on http://www.imagonewmedia.com.

Thanks for all the effort, I am glad to see there is no solution (rather than that I overlooked something) :)


Return to posts index

Kasper Henningsen
Re: Expressions: Determining width of a text layer
on Jul 24, 2017 at 2:09:42 pm

Apply this expression to the anchor point. Not that this thread isn't dead, but for future people appearing here.

sr = thisLayer.sourceRectAtTime();
[sr.left, sr.top];


Return to posts index

Kasper Henningsen
Re: Expressions: Determining width of a text layer
on Jul 24, 2017 at 2:11:49 pm

fml what did I do, I apologize... Try sourceRectAtTime().width, that should work out.


Return to posts index

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