Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Maintain Distance Between Multiple Text Layers

New Here ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

Hello Community,

I am creating a text carousel template where I would like text layers (up to 8) to maintain the horizontal distance between each other if I change the source text.

 

So for example, if I were to change the text in the  "Step Cross Behind" or "Line Dance", I would like to be able to maintain that gap of space between the two without having to manually re-position it each time I need to change the text for a new carousel.

 

I am newer to expressions so any help would be greatly appreciated.  Please let me know if something like this is possible.  Thank you so much.

TOPICS
Expressions

Views

34

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Aug 09, 2021 Aug 09, 2021
You would automate that by having each set of words on a separate text layer and then use sourceRectAtTime() to figure the size of each text layer and add the required space. You would also tie the text layer position and the left value for each subsequent text layer into the calculations It could all be done with the position property of the text layers. Start with the leftmost text layer at the bottom then add this expression to the next layer above it. src=thisComp.layer(index + 1); srcWidth ...

Likes

Translate

Translate
Adobe Community Professional ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

You would automate that by having each set of words on a separate text layer and then use sourceRectAtTime() to figure the size of each text layer and add the required space. You would also tie the text layer position and the left value for each subsequent text layer into the calculations It could all be done with the position property of the text layers. Start with the leftmost text layer at the bottom then add this expression to the next layer above it.

src=thisComp.layer(index + 1);
srcWidth = src.sourceRectAtTime().width;
pad = 80 // distance between layers
newX = srcWidth + pad;
strtPos = src.position;

[strtPos[0] + newX, strtPos[1]]

If you wanted the top layer to be the words on the far left you would change the index + 1 to index - 1.

 

As long as all layers have the same paragraph setting they will line up 80 pixels apart.  All you have to do is position the master (far left) layer. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 10, 2021 Aug 10, 2021

Copy link to clipboard

Copied

LATEST

This was extremely helpful.  Thank you so much Rick, it was exactly what I was looking for!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines