ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Auto-vertically align text layer fed from essential graphics

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
John Angless
Auto-vertically align text layer fed from essential graphics
on Dec 2, 2019 at 12:18:30 am

Hi, I'm new to this forum so apologies if this has already been covered somewhere.

I'm building some templates in Essential Graphics to enable our operators to add animated titles to edits at speed (and scale!) in premiere.

Essentially, I want the text to always be vertically aligned in the centre no matter haw many lines of text there are (the font is large so it's like 6 lines max).
It's left aligned and I want the horizontal position to remain the same (I'm using a text box so the text will automatically wrap onto the next line).

I'm assuming I need an expression on the position of the text layer but my knowledge of expressions is limited to "wiggle()" and "time*"!

I looked at Evan Abrams' description and thought maybe this technique could work but I'm struggling to figure it out.

Any suggestions welcome!

Cheers
John

y=s.sourceRectAtTime(time-s.inPoint,true).height;


Return to posts index

Andrei Popa
Re: Auto-vertically align text layer fed from essential graphics
on Dec 3, 2019 at 8:15:14 am

Put this expression to your anchorpoint


var top = sourceRectAtTime(time,false).top;
var myHeight = sourceRectAtTime(time,false).height;
var y = top + myHeight/2;
[value[1],y]


If you want the anchor point to be in the middle vertically as well as horizontally use this:


var left = sourceRectAtTime(time,false).left;
var top = sourceRectAtTime(time,false).top;
var myWidth = sourceRectAtTime(time,false).width;
var myHeight = sourceRectAtTime(time,false).height;
var x = left + myWidth/2;
var y = top + myHeight/2;
[x,y]


Andrei
My Envato portfolio.


Return to posts index

John Angless
Re: Auto-vertically align text layer fed from essential graphics
on Dec 5, 2019 at 3:37:55 am

Hey Andrei,
Just to let you know this worked perfectly for what I needed to do - many thanks!

Cheers,
John

var top = sourceRectAtTime(time,false).top;
var myHeight = sourceRectAtTime(time,false).height;
var y = top + myHeight/2;
[value[1],y]


Return to posts index

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