Skip to main content
Participant
October 25, 2021
Answered

Center align (horizontally) two text layers to comp

  • October 25, 2021
  • 1 reply
  • 1042 views

Hey all,

Looking for help on aligning two seperate text layers, both of which will be dynamic based on mograph input, to my comp's center.  In others words, I want to the two layers to be centered no matter what is typed in fields.  Any suggestions on building an expresion or script that could help me solve this?

 

 

This topic has been closed for replies.
Correct answer lenzi315

I figured it out.  If you're interested.

 

I centered the first text layer

Used sourceRectatTime to determine its width,

Offset the x position of the second text layer by one half of the first text layer's width

Parented both layers to a null object, centered in the comp

Offset the x position of the null by minus half the width of the second text layer (again using sourceRectatTime)

 

That seems to have solved my problem.

 

1 reply

lenzi315AuthorCorrect answer
Participant
October 25, 2021

I figured it out.  If you're interested.

 

I centered the first text layer

Used sourceRectatTime to determine its width,

Offset the x position of the second text layer by one half of the first text layer's width

Parented both layers to a null object, centered in the comp

Offset the x position of the null by minus half the width of the second text layer (again using sourceRectatTime)

 

That seems to have solved my problem.

 

nishu_kush
Community Manager
Community Manager
October 25, 2021

Glad to hear that you worked it out. Thanks for updating the thread.

Feel free to reach out if there are any other questions.

 

Thanks,

Nishu