Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to randomly change color of characters

  • How to randomly change color of characters

    Posted by Sabri Liefert on March 16, 2013 at 12:40 am

    Hello,

    i want randomly animate the colors of individual characters in a word
    and after a few seconds the colors should transform to white.

    I tried the text animator “hue” with randomize order and seed.
    But that has the drawback that i have to use a fill color before. If i use white text the hue setting doesnt apply.
    The hue setting is also very limited. If applied it doesnt change all letters. Aprox. 20% keep the fill color.

    I think i have to apply an expression selector to the fill color. But i dont know how to define?

    It would be ideal if i could define a color palette for the random colors.

    Thank you very much!

    Dan Ebberts replied 5 years, 10 months ago 14 Members · 42 Replies
  • 42 Replies
  • Dan Ebberts

    March 16, 2013 at 12:50 am

    What do you mean by “randomly animate”?

    Dan

  • Sabri Liefert

    March 16, 2013 at 1:01 am

    Hello Dan,

    the individual characters should change colors randomly over time.

  • Sabri Liefert

    March 16, 2013 at 1:11 am

    This is a screen shot of my amateurish attempt to write the expression.
    The code was only copied from an other project.
    But miraculously worked half way.
    I really dont understand the syntax for expression selectors.

  • Dan Ebberts

    March 16, 2013 at 2:30 am

    Try this:

    text color = white;
    Fill animator color = black;
    Expression Selector Amount = 50%,50%,50%;
    Expression Selector Amount expression:

    seedRandom(textIndex,true);
    w = wiggle(1,50);
    linear(time,0,5,w,[0,0,0])

    Dan

  • Sabri Liefert

    March 16, 2013 at 3:31 am

    That works!
    Thank you very much!

    Is it also possible to take colors from a palette for the random colors.
    Like i have 5 defined colors which rotates randomly at each character?

  • Dan Ebberts

    March 16, 2013 at 4:09 am

    If you change the text color to black and the fill color to white, this will give you random colors for each character from a palette:

    seedRandom(textIndex,true);
    palette = [[100,0,0],[0,100,0],[0,0,100],[0,100,100],[100,0,100],[100,100,0],[100,50,0]];
    // [red,blue,green,cyan,magenta,yellow,orange]
    idx = Math.floor(random(palette.length));
    palette[idx]

    Dan

  • Sabri Liefert

    March 16, 2013 at 1:10 pm

    Thank you very much. That gives me a lot more control for the colors.

    How can i rotate/random change the colors for the letters? The color palette should stay the same.

  • Dan Ebberts

    March 16, 2013 at 3:05 pm

    dur = .25; // length of time to hold each color
    seedRandom(textIndex,true);
    seg = Math.floor((time+random(999))/dur);
    seedRandom(seg,true);
    palette = [[100,0,0],[0,100,0],[0,0,100],[0,100,100],[100,0,100],[100,100,0],[100,50,0]];
    // [red,blue,green,cyan,magenta,yellow,orange]
    idx = Math.floor(random(palette.length));
    palette[idx]

    Dan

  • Sabri Liefert

    March 16, 2013 at 3:44 pm

    Thank you! Exactly what i wanted.

    [But i can produce only the basic 6 colors. Doesnt matter which rgb values i enter in the brackets?]`
    edit: I can produce rgb colors. It hasn´t worked because i had another effect on the layer. sorry for that!

  • Gary Txeusd

    March 26, 2013 at 4:05 am

    Hi Dan,

    Does this effect applies to CS6 ? I can’t seem get it work ?

Page 1 of 5

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