Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Auto-vertically align text layer fed from essential graphics

  • Auto-vertically align text layer fed from essential graphics

  • John Angless

    December 2, 2019 at 12:18 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;

  • Andrei Popa

    December 3, 2019 at 8:15 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.

  • John Angless

    December 5, 2019 at 3:37 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]

Viewing 1 - 3 of 3 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy