This is a simplistic example that might get you started. Add a Fill Animator to your text layer, then add an Expression Selector, then add this expression to the Expression Selector’s Amount property:
targetWord = “test”;
txt = text.sourceText;
idx = txt.indexOf(targetWord);
if (idx > -1){
if (textIndex > idx && textIndex <= (idx + targetWord.length)){
100
}else{
0
}
}else
0
If your text has the word “test” in it, it should be red. This has a lot of limitations though. Only the first occurrence of the word will be colored. It won’t work right if your text is multi-line. It doesn’t account for capitalization (e.g., it won’t match “Test”).
You could certainly come up with a more robust solution, depending on your requirements.
Dan