ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Change the colour of a word in a block of text based on its length

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nawaz Alamgir
Change the colour of a word in a block of text based on its length
on Sep 27, 2018 at 11:34:49 am

I have a block of text, on around 20 lines, what I am trying to do is change the colour of a word based on its length, so all words with a length of 6 (or greater than) characters are RED.

Should be simple enough but I can't seem to figure out an expression to call the word length in sourceText.

Can anyone help?


Return to posts index

Dan Ebberts
Re: Change the colour of a word in a block of text based on its length
on Sep 27, 2018 at 4:04:37 pm

You could add a fill color Animator, then add an Expression Selector, set Based On to Words, and use this for the Amount expression:


words = text.sourceText.replace(/^\s+/, "").split(/\s+/);
if (words[textIndex-1].length >= 6 ) 100 else 0



Dan



Return to posts index

Kalleheikki Kannisto
Re: Change the colour of a word in a block of text based on its length
on Sep 27, 2018 at 7:16:24 pm

Definitely black magic. 👹😲

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index


Nawaz Alamgir
Re: Change the colour of a word in a block of text based on its length
on Sep 28, 2018 at 1:59:19 pm

Thank you for that bit of magic. Works like a charm. You legend.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]