Skip to main content
Participant
July 25, 2022
Question

Expression to change font size on a new line of text

  • July 25, 2022
  • 4 replies
  • 2631 views

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

4 replies

Participant
July 25, 2022

Thanks everyone for the answers!! I will give them all a go and I'm sure one will do the trick!! Much appreciated.

 

Mathias Moehl
Community Expert
Community Expert
July 25, 2022

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/

 

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Mylenium
Legend
July 25, 2022

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

Community Expert
July 25, 2022

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

Participant
July 25, 2022

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?