ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Making Titles that Automatically Adjust due to string length.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Chris Breaux
Making Titles that Automatically Adjust due to string length.
on Nov 30, 2018 at 8:31:26 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


Return to posts index

Kalleheikki Kannisto
Re: Making Titles that Automatically Adjust due to string length.
on Dec 9, 2018 at 10:53:25 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]