Skip to main content
Inspiring
August 26, 2022
Answered

Changing specific words in a line of text using the drop down menu

  • August 26, 2022
  • 2 replies
  • 577 views

I am using a drop down menu to change a line of text but, I can't alter the styling of the text without altering the entire line. I only need to change one or two words of the line with my drop down so is there a way to make it only change the words in a selected range?

 

I normally just have multiple versions of the text layer and use the drop down to toggle their opacity but I'd like to get this on one layer if possible.

 

Thanks

This topic has been closed for replies.
Correct answer Roland Kahlenberg

The get Functions allows you to obtain the text style from any character; not just the first character. The getStyle function allows for two arguments, index and atTime.

text.sourceText.getStyleAt(index, atTime);

More info here - 
https://helpx.adobe.com/after-effects/using/expressions-text-properties.html

The main limitation is with being able to have only one textStyle per Text Layer when working with Text Layer Style Expressions.
HTH


2 replies

ShiveringCactus
Community Expert
Community Expert
August 28, 2022

Could you use a Text Animator's Range option with an expression based on the dropdown value?  

The value of the dropdown menu returns from 1 onwards, but the range value counts the first word as 0.  In the range start  expression, you just need to pickwhip the dropdown value, then add -1

The End value is just +1 of the start, with the Advanced settings using the index and words as options.

 

 

Mylenium
Legend
August 26, 2022

Long and short: No. This is a known issue/ limitation of text style expressions. As soon as you change the source text with an expression, the source formatting is lost and only the style of the first letter is used. Stick with splitting layers.

 

Mylenium

Inspiring
August 26, 2022

That's a shame, thanks anyway