Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Making Titles that Automatically Adjust due to string length.

  • Making Titles that Automatically Adjust due to string length.

    Posted by Chris Breaux on November 30, 2018 at 8:31 pm

    I’ve made my title and if the name is 20 characters the box will automatically adjust using the code below for the size & position. All text is left aligned. Success! it worked!

    Now I’m re-making the titles so they can be right aligned for titles on the right side of the screen. All text is right aligned and I’m running into a problem(See Right Aligned Text) So how would I change the code so that when text is typed, the “blueRectangle” shape layer moves to the left instead of the right?

    Right Aligned Text:

    Here’s the left aligned text that works:

    Hope this makes sense. I’m no coder & any help would be much appreciated. Thx Chris

    Expressions Used for the "content" of rectangle 1

    SIZE:
    s =thisComp.layer("NAME_HERE");
    x = s.sourceRectAtTime(time-s.inPoint,true).width;
    y = s.sourceRectAtTime(time-s.inPoint,true).height;
    [x,y]

    POSITION:

    content("Rectangle 1").content("Rectangle Path 1").size/2

    Kalleheikki Kannisto replied 7 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kalleheikki Kannisto

    December 9, 2018 at 10:53 am

    It is either just moving the anchor point to the edge that is fixed or that and taking the “/2” out of the last line.

    Kalleheikki Kannisto
    Senior Graphic Designer

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