Copy link to clipboard
Copied
I see some people with examples on this forum but I'm having trouble applying them. I'd appreciate anyone who can use my attached project so I can understand by seeing what you did as a reference.
I'm using this template to export a .mogrt file with a Header text layer, and a Sub-Head text layer that I can edit in Premiere Pro.
I'm trying add an expression that maintains the vertical distance between the bottom of the Header to the top of the Sub-Head when new lines are added to the Header. I would also like both Text boxes to always be centered vertically based on the height of both text boxes.
I'm willing to pay/donate to anyone who can edit my attached template and guide me.
I took a quick look at your project. You'll need to incorporate sourceRectAtTime() for the position on both layers, probably add a null as a master position controller, and throw in some other expressions and controls to set padding and offset the spacing between layers. You also need to decide if you want to continue to use a text box or rely on carriage returns to create multiple lines.
If I get some time this afternoon, I will post some example expressions and layouts. It's pretty straight
...Copy link to clipboard
Copied
I did something very similar a month ago, let us know if you can manage with this.
Copy link to clipboard
Copied
That's close. The spacing does stay consistent when the parent position itself is moved, but if I add an extra line to the parent the sub-text doesn't shift down.
Copy link to clipboard
Copied
I took a quick look at your project. You'll need to incorporate sourceRectAtTime() for the position on both layers, probably add a null as a master position controller, and throw in some other expressions and controls to set padding and offset the spacing between layers. You also need to decide if you want to continue to use a text box or rely on carriage returns to create multiple lines.
If I get some time this afternoon, I will post some example expressions and layouts. It's pretty straightforward, but cleaning up your project will take some time.
Here are a couple of expressions to get you started. First, put your Main Headline layer on top of the smaller text layer. Then, add the expression to both text layers' Anchor Points to center the Anchor Point inside the text, regardless of the paragraph justification.
// Center Anchor Point
box = sourceRectAtTime();
[box.width/2 + box.left, box.height/2 + box.top];
This will center both text blocks in the Comp Panel.
Now add this expression to the bottom text layer's position to position it directly below the top text layer:
ref = thisComp.layer(index -1);
P = ref.position;
refBox = ref.sourceRectAtTime();
box = sourceRectAtTime();
vPad = 20; // 20 pixel pad - could be a slider
refBtm = refBox.height/2 ;
P + [0, box.height/2 + refBox.height/2 + vPad]
This will stack the bottom layer below the top text and give it a 20-pixel gap.
I also added a light gray solid guide layer to the timeline to make it easier to see the dark text. Guide layers will preview but they will not render.
You can set the position of the top text layer by applying the Effects/Expression Controls/ Point Control to the layer's position or with an expression that relies on sourceRectAtTime().height and top to keep the top of the main text layer in a constant position.
Maybe this will get you started. I'm on my way to a location shoot. I'll check back later.
Here's a project file for you.
Copy link to clipboard
Copied
It will take more code on the position of the top text layer to get the top to stay in the same spot on the screen as more text is added.
Copy link to clipboard
Copied
This was a great start. I'll still have to research a bit to understand but this lets me know exact terms to look up.
And yes, I noticed the Header doesn't move up when adding more lines to the Sub-Head. Just need your knowledge on that part and I got everything that I was looking for.
Really appreciate it. Message me your Venmo, Zelle, or Paypal so I can compensate you for your time.