Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Change the font size via expressions

  • Change the font size via expressions

    Posted by Ilya Zhdanko on December 30, 2020 at 9:47 pm

    Hi guys. I need to change the font size of the second part of my “Source text” layer. I mean that the first word of this layer has one size, and the second one has another size.

    Like:

    a='Hello,'; // my first word

    b=' World!'; // my second word

    ...

    a+b; //final result (but with one font size)

    How to change the font size of the second word via expressions?

    Kevin Camp replied 5 years, 8 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kevin Camp

    December 31, 2020 at 5:24 pm

    I don’t believe you can affect the point size of part of a singe source text with expressions, but I’ve done something similar with two text layers and a sourceRectAtTime() expression to make the second text layer follow the first.

    Try this:

    Create two text layers and type Hello into one and World into the other, then parent World to Hello (this isn’t totally necessary, but it makes the expression a bit simpler and you probably want them to stay together anyway).

    Add this expression to the World layer’s position property:

    rect = parent.sourceRectAtTime() ;

    w = rect.width ;

    value + [ w, 0 ]

    The World layer should now follow Hello and you can change the point sizes of the layers independently, but both layers are right next to each other.

    Assuming you want a space between them, you can add that in the expression by adding the amount of pixels you need between them, something like this:

    rect = parent.sourceRectAtTime() ;

    w = rect.width ;

    pad = 30 ;

    value + [ w + pad, 0 ]

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy