Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions I need help – How to change text colour every other letter

  • I need help – How to change text colour every other letter

  • Ringo Roo

    June 23, 2022 at 3:12 am

    Hi,

    I’m trying to create editable text that changes between black and white every other letter.

    I’m fairly new to expressions, but was hoping to find a way of (what I know from a long time ago) creating a For Next loop to select each character and change it’s colour.

    Any help would be greatly appreciated 🙂

  • Dan Ebberts

    June 23, 2022 at 6:36 am

    Type your text in the color you want letters 1,3,5… to be. Add a RGB Fill Color Animator and set the color to the color you want for letters 2,4,6…, add an Expression Selector and set Based On to Characters (or Characters Excluding Spaces) and set the Amount expression to this:

    textIndex%2 ? 0 : 100
  • Adam Greenberg

    June 23, 2022 at 1:12 pm

    that is so clever, Dan,

    so I have a follow up question, how would we re-write this for 3 colors for every 3rd letter, and so forth ( 4, or 5, etc… ) ?

  • Dan Ebberts

    June 23, 2022 at 2:25 pm

    I guess you could repeat the process and add another fill color animator and another expression selector, then change the expression for the first selector to:

    (textIndex-1)%3 == 1 ? 100 : 0

    and set the expression for the second one to:

    (textIndex-1)%3 == 2 ? 100 : 0

    Extrapolate the process for more colors. For four colors the first expression would become:

    (textIndex-1)%4 == 1 ? 100 : 0

    etc.

  • Adam Greenberg

    June 23, 2022 at 4:38 pm

    great. Thanks so much Dan

Viewing 1 - 5 of 5 posts

Log in to reply.

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