Copy link to clipboard
Copied
I'm creating my first mogrt and trying to work out how I can create it so that when the text is typed in, it doesn't align and push the text outside of my mask?
Copy link to clipboard
Copied
I am not quite sure what your design goal is. If you want the yellow line to match the length of the text you can use sourceRectAtTime() to adjust the length of the yellow line with an expression. If you want the characters to always fit over the yellow line then you also use the same sourceRectAtTime() method but you drive the scale of the text layer so that it always covers the entire line. I don't see a mask in your screenshot so I am not sure what the mask has to do with it.
Please give us a detailed design description and we can probably help you figure things out. The usual way to make this kind of MOGRT is to have a text box adjust its size based on the size of the text line using soruceRectAtTime() and tie the position of the text box to the position of the text layer, also with an expression.
Copy link to clipboard
Copied
Sorry, might be easier to show you what I mean. Any help much appreciated, thanks.
Copy link to clipboard
Copied
Set the text to Left Justify. You have the paragraph style set to Centered.
When you do that you can then add an expression to the yellow line so that the line always matches the length of the characters.
Let us know if you need help with that expression. I'm guessing that you are using the Slider in Extended Graphics to adjust the length of the line. It would be much more efficient to have the length of the line controlled by a pair of simple expression like this:
// Rectangle 1/Rectangle Path 1/Size
x = thisComp.layer(index - 1).sourceRectAtTime().width;
[x, value[1]]
// Rectangle 1/Rectangle Path/Position
x = content("Rectangle 1").content("Rectangle Path 1").size[0] / 2;
y = content("Rectangle 1").content("Rectangle Path 1").size[1] / 2;
pad = 10; // pad set to 10 pixels
[x, y + pad]
// And if you want to tie the position of the text layer to the line add this to Position
thisComp.layer(index - 1).transform.position
The comp looks like this:
I used a rectangle that was only 8 pixels high to create the line instead of a path because it's easier to control the width of the line. As long as the text layer is just above the line layer the expression will work. If you want the text behind the line then change index - 1 to index + 1 and move the text layer below the line layer.