Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Animated dynamic textbox with rounded corners

  • Animated dynamic textbox with rounded corners

    Posted by Johannes Tönne on May 14, 2021 at 7:58 am

    Hi everybody,

    i searched for a solution for this for a long time, but could not find any.

    I made a textbox with the sourceRectAtTime expression that dynamically fits to my text. This works fine. The box is a shape layer with rounded corners and the expression works on the Size property. Now i want to animate this box scaling up in width. If i use the scale property, the corner roundness gets weird, obviously. I know i could use a duplicate text layer with text animation as reference for the scale (i want to animate the visibile text differently than the box), but this seems a bit convoluted to me, there must be a better solution. Another option would be to subtract from the size with a slider, but then it would not be dynamic anmyore, since the text will sometimes be shorter or longer, so i need to animated my width in percentage value.

    Does anyone have an idea?

    Best regards,

    Johannes

    Johannes Tönne replied 5 years ago 3 Members · 3 Replies
  • 3 Replies
  • Trent Armstrong

    May 14, 2021 at 4:55 pm

    Hi!

    I’m not sure I understand “fully” what you’re trying to get, but I remember seeing somewhere a solution for rounded corners where circles were used on each of the corners for the rounding instead of the Corner Roundness. I think they were attached to the corners with Nulls, but maybe you could do the same thing with sourceRectAtTime().

  • Chris Voelz

    May 14, 2021 at 6:16 pm

    I made this for someone on my team awhile back, hopefully it helps.

  • Johannes Tönne

    May 17, 2021 at 7:22 am

    I got help on the Adobe forum. The trick is to use a linear expression, something like this:

    mSlider=thisComp.layer("XYZ").effect("Scale")("Slider");mWidth=thisComp.layer("Text").sourceRectAtTime().width;mWidth+linear(mSlider,0,100,0,mWidth);

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