Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Highlight specific word with a symbol in front supporting line breaks

  • Highlight specific word with a symbol in front supporting line breaks

  • Frederik Damsgaard

    January 26, 2023 at 5:07 pm

    Hi

    I found this expression making it able to color fill a specific word in a text layer.

    words = text.sourceText.split(” “);

    currentWord = words[textIndex-1];

    if(currentWord.charAt(0)==”@”){color=100}else{color = 0};

    [color,color,color]

     

    It is used with fill color animator + expression selector based on words.

    I can’t get it to work if the text is in two or more lines. Is it possible to get to work in multiple lines?

     

    Also, would it be possible to instead do the expression, so that it color fills multiples words within the symbols < and >.

    “Here is an example <where these four words>

    should be colored”

  • Dan Ebberts

    January 26, 2023 at 5:28 pm

    Try this for the first one:

    words = text.sourceText.split(/\s+/);
    words[textIndex-1][0] == "@" ? 100 : 0
  • Frederik Damsgaard

    January 27, 2023 at 7:46 am

    Amazing, this is so much more elegant, and it works too, haha!

    Thank you!

Viewing 1 - 3 of 3 posts

Log in to reply.

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