Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Adam Goddard on October 15, 2021 at 3:52 pm

    Hi, I am in a jam here. I have a list of 943 names [First Last,] separated by a comma. The client wants to run along the bottom of the screen like a feed on a jumbotron. I am wondering if there is a way to write an expression on this huge text layer that tells the first name to be HEX #F6F6FA and next name HEX #FFe600 then alternate these colours (white, yellow, white, yellow etc… for each name for all 934 name instances separated by a comma.

    Many thanks for your help in advance.

    Kevin Camp replied 4 years, 7 months ago 2 Members · 1 Reply
  • 1 Reply
  • Kevin Camp

    October 15, 2021 at 7:24 pm

    There is probably a more elegant way to do this with a single text animator for Fill Color, but this seems to work — note I am assuming your text looks something like this: “John Doe, Jim Smith, Jane Jones”

    It’s easy to make a text animator work on words, but I couldn’t figure out a way to split it at the commas and colorize based on that result, so I found another way.

    Try this:

    On your text layer with all the comma separated names, apply this expression to the source text property:

    value.replace(\/s\g,'_').replace(\,_\g,', ') 

    That should put underscores between all the first and last names, but keep the commas.

    Now we can easily colorize every-other-name with a text animator. Just add a text animator for Fill Color, set the color as needed and add an Expression Selector to the animator and add this expression to the Amount:

    textIndex % 2 * 100

    Every-other-name should now be colorized.

    To replace the underscores with spaces, add a new text animator (so you’ll have Animator 1 and Animator 2), this time for Character Value, set the Character Value to 32 (which is the ASCII code for a space), then add an Expression Selector to that Animator and enter this expression for Amount:

    if ( text.sourceText.value[textIndex-1] == '_' ) { 100 } else { 0 }

    That should find all the underscores and replace them with spaces.

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