Copy link to clipboard
Copied
Hey there,
I'm a total hack when it comes to expressions so my apologies for asking what is probably a very basic question with a simple answer.
I'm trying to create a text layer with 2 lines of text. The first line is linked to a slider so I can animate it and beneath it (on a second line) I just want the word "Growth". I've managed to get that happening fine with this expression: Math.round(effect("Slider Control")("Slider"))+"x"+"\r" + "GROWTH"
However I want to be able to control the font size of just the word "Growth", rather than changing the font size of all the text. I can't work out how to use a 'setfontsize' modifier on just that one word/line.
Any help would be much appreciated.
Cheers
Tim
Copy link to clipboard
Copied
I am pretty sure that the setFontSize operator only operates on the entire line of text. Here's the documentation.
https://helpx.adobe.com/after-effects/using/expressions-text-properties.html
Copy link to clipboard
Copied
Thanks for your prompt reply Rick. If not the setFontSize operator, would you know of another way to achieve what I described? Or should I resort to just creating another separate text layer?
Copy link to clipboard
Copied
I have created about twenty Animation Presets for controlling text layers, backgrounds for text layers, and graphics associated with text layers. The heart of all of them is sourceRectAtTime.
You can retrieve any text layer's height, width, and position by using height, top, width, and left values. This expression puts the bottom layer underneath the top layer and lines up the left side no matter the paragraph justification for either layer.
// look at the layer above
ref = thisComp.layer(index -1)
p = ref.position;
s = ref.sourceRectAtTime();
tl = sourceRectAtTime().left;
sf = scale[1] * .01;
pad = 10;// 10 pixel padding
p + [s.left - tl, pad + s.height * sf]
Add that expression to the position property of the text layer below the main text, and it will always be below the left layer and lined up with the left edge. You can then adjust the bottom text layer's scale to control that layer's size. You could also add a slider to control scale if you like and another slider for padding.
Select the bottom text layer's position property and save it as a custom animation preset, and you have a tool you can use any time. It also would work with Essential Graphics to create a MOGRT for Premiere Pro.
Copy link to clipboard
Copied
You can always add a size/ scale text animator and set its mode to per line. Depending on what fonts you use the results may vary, though, and could be unsatisfying, since the kerning and some otehr stuff affecting visual rendering won't be adjusted and will look differently at different sizes.
Mylenium
Copy link to clipboard
Copied
Another option is to use multiple text layers. To attach the second text to the bottom of the first one, you can either write position expressions with sourceRectAtTime, or use my tool Pins & Boxes.
https://aescripts.com/pins-and-boxes/
Copy link to clipboard
Copied
Thanks everyone for the answers!! I will give them all a go and I'm sure one will do the trick!! Much appreciated.