Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions how do i get text to have every letter be a random colour from a selection of 3 colours?

  • how do i get text to have every letter be a random colour from a selection of 3 colours?

    Posted by Jeremy Webb on September 11, 2014 at 4:37 pm

    i have text on screen that is typed in after effects. I would like it to appear that each letter is randomly one of 3 colours. i was doing this manually by selecting each letter and change the colour to one of the 3 preselected colours, but i thought that there has got to be an expression to do this. Any ideas?

    Jeremy Webb replied 11 years, 11 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    September 11, 2014 at 5:09 pm

    Try this. Use black text and add a Fill Color animator and set its color to white. Add an Expression Selector, and delete the Range Selector. Add this expression to the Expression Selector’s Amount property:

    colorArray = [[1,0,0],[0,1,0],[0,0,1]];
    seedRandom(textIndex,true);
    colorArray[Math.floor(random(colorArray.length))]*100

    That should give you a random selection of the three colors specified in colorArray (red, green, and blue in this example).

    Dan

  • Jeremy Webb

    September 11, 2014 at 7:36 pm

    Nice one dan! really great! my only question is how do I put rgb values into that? it seems in the first line, a “1” sets it to full 255 for that channel.

  • Dan Ebberts

    September 11, 2014 at 7:40 pm

    Color values in expressions range from 0.0 to 1.0

    so, for example, you could represent medium gray like this:

    [.5,.5,.5]

    or like this:

    [127,127,127]/255

    Dan

  • Jeremy Webb

    September 11, 2014 at 9:13 pm

    aahhhh, that makes sense. now it all works fine. thanks so much!

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