Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Combine expressions for position and anchor point with text animator

  • Combine expressions for position and anchor point with text animator

    Posted by Christian Geijer on August 10, 2018 at 7:51 am

    Hi,

    I have a paragraph text connected to a .json-file for its value.
    Let’s say I want the text to be centered in the composition, so I enter this position expression.
    [thisComp.width/2, thisComp.height/2]

    The source text from the .json-file can differ in length so to make sure that the text remains centered no matter what is inputted I use this expression on the anchor point.
    boxTop = this.sourceRectAtTime().top;
    boxHeight = this.sourceRectAtTime().height;
    boxLeft = this.sourceRectAtTime().left;
    boxWidth = this.sourceRectAtTime().width;
    h = boxTop + boxHeight/2;
    w = boxLeft + boxWidth/2;
    [w, h];

    This works just as intended. But if I want to add an animator for the position – let’s say to animate each line one by one up 20 pixels – this doesn’t work because I’ve locked the anchor point with the expression above. If I remove this expression the animator works just fine. But then I can’t make sure that the text remains centered.

    My questions regarding this are:
    1) Is there a smarter/better way to make sure the text stays centered than using the combination of expressions above?
    2) If not, is there a way to combine the animator for the text and still make sure the text stays centered in the composition?

    Best regards,
    /C

    Christian Geijer replied 7 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Kalleheikki Kannisto

    August 11, 2018 at 7:59 am

    Pick a time before the text animation starts as the time value, as in sourceRectAtTime(*your static time value here*).

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Christian Geijer

    August 13, 2018 at 6:50 am

    Of course! Thank you so much for your help.
    Have a great week!

    /C

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