Page 1 of 1

Text layer and expression

Posted: March 10th, 2014, 6:27 am
by videoprice
Hello guys. Need help with expression.
I have 2 layers : Text layer and solid layer.
Image

So, I need then I type a text my solid layer scale automatically in x postion. Thanks a lot guys.

Richard

Re: Text layer and expression

Posted: March 10th, 2014, 9:25 am
by Aaron Cobb
This can't be done with an expression alone. You have to use a script to measure and mark the dimensions of the layer, using the AVLayer sourceRectAtTime() function (the scripting docs has the exact syntax). My preferred method to mark the layer is to add a point control to the text layer for the upper left and lower right corners. Then you can either scale the solid using the script, or use an expression to do it.

Re: Text layer and expression

Posted: January 7th, 2015, 7:16 am
by fahdchishty
sourceRectAtTime() does not work in expressions, only in scripts. For versions CS6 and below there is no property of text with that name that can be accessed through expressions. Look at nab's expression here http://www.aenhancers.com/viewtopic.php?f=6&t=931

Though if you want a workaround then You need to control the x scale of your elements via a slide controller. Make one NULL object as "Width Controller" and on it add Effects>Expression Controls>Slide Controller. Take the x scale of your element (e.g. a rectangle shape behind your text) and pickwhip it to that Slide Controller.

Re: Text layer and expression

Posted: January 7th, 2015, 5:18 pm
by Dan Ebberts
I should point out that the latest version of AE CC 2014.2 (build 13.2.0.49) does support sourceRectAtTime() for expressions.

Dan