• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Keeping subheading same distance from text

Community Beginner ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

Hello all. I have a MOGRT template made that allows people to change the Main Heading on an Intro and also the Subheading (as you can see on the image). What I am trying to do in AE is ensure the Subheading sticks to the same distance away from the Main Heading wether someone changes the text 2 lines or 4 lines in Premier.

Hope Ive made sense. As always thanks in advance.

TOPICS
Expressions

Views

542

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

LEGEND , Feb 13, 2023 Feb 13, 2023

You simply add whatever values you want to the position of the subheadline. Example:

 

mHead=thisComp.layer("Heading");
mPos=mHead.transform.position;
mDist=mHead.sourceRectAtTime().height;

mPad=30;

X=mPos[0];
Y=mPos[1]+mDist+mPad;

[X,Y]

 

Mylenium

Votes

Translate

Translate
LEGEND ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

The usual solutions involving sourceRectAtTime() will sufficiently do the trick. Here's a tutorial and there are a million others:

 

https://www.youtube.com/watch?v=In4miXUdxko

 

Mylenium

Votes

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
Community Beginner ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

Thanks for the quick reply @Mylenium I was looking at this to make an invisible box around the text as psuedo padding, but how can I link the subtitle text to that Main text to ensure it stays the same distance away when someone changes the text? I was thinking, can I lock it to the bottom of the psuedo box? I can't work out how to do that or is there a more obvious way.

Votes

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
LEGEND ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

You simply add whatever values you want to the position of the subheadline. Example:

 

mHead=thisComp.layer("Heading");
mPos=mHead.transform.position;
mDist=mHead.sourceRectAtTime().height;

mPad=30;

X=mPos[0];
Y=mPos[1]+mDist+mPad;

[X,Y]

 

Mylenium

Votes

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
Community Beginner ,
Feb 14, 2023 Feb 14, 2023

Copy link to clipboard

Copied

Great, I'll try that @Mylenium Thanks for your help.

Votes

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
Community Beginner ,
Feb 14, 2023 Feb 14, 2023

Copy link to clipboard

Copied

LATEST

This worked a treat. Thank you!

Votes

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