Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Automating a text block to slide up or down

  • Automating a text block to slide up or down

    Posted by Jeff Hinkle on February 22, 2023 at 10:27 pm

    Couldn’t find a previous solution that quite matches my situation, or one I could adjust to fit.

    Building a TV tag mogrt and I have a circle shape and a text block of separate animating text layers that lives in the circle. The layers are precomped but need to remain as separate layers. The height is naturally variable depending on the title length (1 line or 2 line) and if the optional marketing line has text or not. The title block precomp has been cropped to the size of the shape circle and is parented so it stays with the circle in one of its three predetermined positions (screen left, screen right, center). Hopefully that all makes sense.

    Now I need the text block to stay vertically centered to the circle. I’ve used sourceRectAtTime on each text layer and combined them to get the total height of the text block. Easy enough. I have the height of the circle, of course. Now I figure there’s some way to take that information and use it to adjust the Anchor Point Y value of the precomp (which, again, currently matches the center of the circle) so the text block slides up/down to remain vertically centered no matter what the text is. Been experimenting a couple hours and feel I’m no closer to a solution. I have everything else wired up and working, it’s just this last detail preventing me from wrapping it up.

    Any suggestions on automating this?

    Jeff Hinkle replied 3 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 22, 2023 at 10:44 pm

    Hard to be precise without seeing any of the details, but I’d create a position (not anchor point) expression for the text pre-comp where you calculate the current y position of the center of the text, subtract that from the y position of the center of the circle and add the result to the current value, roughly like this:

    yT = textCenter[0];
    yC = circleCenter[1];
    yAdjust = yC - yT;
    value + [0,yAdjust]
  • Jeff Hinkle

    February 23, 2023 at 3:52 pm

    Thanks, Dan. Your suggestion got me looking in the right direction enough I was able to stumble onto a solution. Not super-elegant but it’ll do the job. Appreciate the help!

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