Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is it possible to create text flags for custom text styles for Motion Graphics Templates?

  • Is it possible to create text flags for custom text styles for Motion Graphics Templates?

    Posted by Clint Porter on June 16, 2020 at 1:58 pm

    Hi everyone,

    I’ve been making more and more Motion Graphics Templates for my editor coworkers, and I’d love to be able to give them a way to set individual words in bold, italic, or perhaps a custom callout color.

    Is there an expression I can write that would allow me to use some agreed-upon markers in the text string, like perhaps < b >< /b >, and < i >< /i >, to switch out the font or the text fill color?

    Thanks so much!

    Filip Vandueren replied 1 year, 2 months ago 4 Members · 10 Replies
  • 10 Replies
  • Filip Vandueren

    June 18, 2020 at 8:25 pm

    AFAIK, you can now get and set the style of a text-layer via expressions,
    but you can only set the style of the entire layer, not individual letters/words, ranges.

    Alternatively, you could do faux Bold, faux italic, and colors easily using textAnimators.
    A Bold would be a thicker Stroke on some letters, Italic would be a slight Skew, Fill and Stroke colors can be set with textAnimators too.

    Using some expressions on The sourceText and expression Selectors on those animators, a Frankenstein html-parser can be created, although – of course – it renders horribly slow.

    Here’s something I spitballed together:

  • Clint Porter

    June 18, 2020 at 8:50 pm

    Wow Filip, that’s really amazing! Nice job on that!

    While I’m really looking forward to the day that After Effects can give Premiere users something more flexible, I think I’ll try to incorporate the color fill code into what I’m making.

    Thanks again! -Clint

  • Victor Ribbs

    July 9, 2020 at 3:34 pm

    this is exactly what I’m looking for but I have a error typeError ranges.toSource is not a function, I populate the text field with a script.
    could you help me ?

  • Filip Vandueren

    July 9, 2020 at 3:36 pm

    This project uses the old Javascript engine.
    Project Settings -> Expressions -> Extendscript Legacy.

    I’ll try and fix it tomorrow, but it’s still just a proof of concept, don’t know if this is production-ready.

  • Filip Vandueren

    July 9, 2020 at 3:49 pm


    has to become:


    and every eval() has to be changed to JSON.parse()

  • Victor Ribbs

    July 9, 2020 at 3:54 pm


    i have find this

    Returns an array of strings listing the properties and methods available.

  • Victor Ribbs

    July 9, 2020 at 4:04 pm

    it works with your corrections

  • Malcolm Ricci

    September 19, 2022 at 2:22 pm

    Hey Filip,

    I’ve recently come across this and it works great, so thanks first of all.

    I wanted to ask whether there is anything that I could do to avoid it taking so long to render…

    I’m relatively new to expressions, but from what I’ve understood is it taking so long due to it having to go through every layer on every frame?


  • Filip Vandueren

    September 20, 2022 at 11:17 am

    Hi Malcolm, as you know that solution was just a purely academic excercise to see if I could figure out some way to do it in just 1 layer.

    I’ll see if I can come up with some optimisations, but expressions selectors always seem to bog down after effects. I’ll report back shortly.

  • Filip Vandueren

    September 20, 2022 at 11:53 am

    Here’s a version that doesn’t try to do everything in 1 layer, and also a slightly different approach on how I stored the ranges.

    – 1 guide-layer to enter the “html”

    – 1 guide-layer to analyse what character-ranges are affected by what “tag”

    – 1 layer that “renders” the html.

    It should render about 2.5 times faster, but I’m sure there’s still room for improvement.

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