ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Left align the position of a text layer with dynamic scaling

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Niels B Nielsen
Left align the position of a text layer with dynamic scaling
on Aug 30, 2018 at 3:29:10 pm

I have a text layer. The text layer size can dynamically be scaled from Premiere. I want the text to always be left aligned at same position even when I scale the text.

It seems that the anchor point from where the text layer scales cant be moved with a text layer? Can this left alignment be achieved through an expression instead?


Return to posts index

Scott McGee
Re: Left align the position of a text layer with dynamic scaling
on Aug 31, 2018 at 7:34:23 am

Is this something that has been built in after effects then used in premiere? Otherwise I'm not sure how to help.


Return to posts index

Niels B Nielsen
Re: Left align the position of a text layer with dynamic scaling
on Aug 31, 2018 at 8:32:32 am

Yes, I'm building the graphic in After Effects and use it in Premiere with dynamic linking for text and parameters like text-layer scaling back to After Effects.


Return to posts index


Scott McGee
Re: Left align the position of a text layer with dynamic scaling
on Aug 31, 2018 at 12:58:49 pm

In that case.

A few possibilities.

If you want it anchoring and scale up from a corner. Or directly from the centre of the left position.

Add one of the following to your AE project to it's anchor point.

Left/Top Corner
r = sourceRectAtTime();
[r.left,t.top]


Left Centre
r = sourceRectAtTime();
[r.left,t.top + r.height/2]


Left Bottom Corner
r = sourceRectAtTime();
[r.left,t.top + r.height]


This will fix your anchor point and when you scale it will stay in the position you have assigned it.

Now based on your message you are scaling in Premiere as in using the scale in Premieres effect control. If you are in CC 2017.2 (I think, it might be an earlier version. I'd use Essential Graphics and add a slider control to your scale layer). If you are on an earlier version that hasn't got Essential Graphics. There's still away but it's a but more awkward.

Create a text layer. Call it scale.

Then in Scale of your text add the following.

s = parseInt(thisComp.layer("scale").text.sourceText);
if(isNaN(s)){
s = 100;
}else{
s;
}
[s,s]


Make sure you have check template for use with Premiere if you are on a version that doesn't let you export as a text template, which is in export if it is.

Then in premiere in effects control when you bring it in, it should have an additional section called Master control next to the effects control tab. This will allow you to type in the scale number you want from 0 - I think 10000, I can't remember what the max number is. If you happen to put text in it though "TEST" for example the above expression will default to 100, but it doesn't recognise it as a number.

There's a few other ways to do this, but the above two are the most efficient ways, Essential Graphics being the main one, but I know at home I'm stuck on CS5.5 so I have to do it the second way and both work flawlessly.

If you decide you want the anchor and position to change. So it scale up from Top Left, Bottom Left or Centre. You'll have to adapt the anchor point expression and a position expression, then again a a checkbox or text box, or even a slider control that will change on command.

Dynamic link can only do so much in Premiere from After Effects and it doesn't understand the individual layers, which is why you are having your problem.

Hope the above helps. If not I'll try and break it down a bit better.


Return to posts index

Niels B Nielsen
Re: Left align the position of a text layer with dynamic scaling
on Sep 3, 2018 at 1:44:24 pm

Thanks! sourceRectAtTime().left for the x position worked for me. Thanks again :)


Return to posts index

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