Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expression to assign a color to a letter?

  • Kalleheikki Kannisto

    June 19, 2019 at 12:55 pm

    It is curious, but if you use paragraph type (draw a box to contain the text) and let the line breaks fall where they may, it works, but if you use point type and insert manual line breaks it doesn’t.

    I guess it could be considered a low-concern bug of sorts. Or at least an annoyance. Apparently AE omits line breaks in index calculation but includes them in the character count. So it would require a more complex expression to find out exactly what character is at which position if you want to use manual line breaks.

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Ari Grunzeweig

    June 19, 2019 at 1:26 pm

    Interesting!

    I ended up doing in manually for the sake of time, but your idea makes sense.

    Thanks 🙂

    Thanks,
    Ari

  • Joel Bellagamba

    June 19, 2020 at 8:38 pm

    Is there a way to change this expression to apply a different sequential color (say, from a set of 5) to each letter, in order – so the code doesn’t have to reference every character?

    I realise the result won’t be obviously random, for large amounts of text – but great for short titles where each letter can be colorized specifically, using code.

  • Filip Vandueren

    June 21, 2020 at 7:10 pm

    Sure,

    that would be quite simple:

    colours=[
    [255,128,0],
    [0,102,0],
    [153,0,153],
    ]; // add as many colours as needed.

    var i = textIndex % colours.length;
    colors[i]/2.55;

  • Joel Bellagamba

    June 22, 2020 at 9:31 am

    Works perfectly, Filip (just needed to change “colours” on the bottom line).

    Thanks for sharing your knowledge, it’s a massive help.

  • Filip Vandueren

    June 22, 2020 at 9:45 am

    Dammit ☺ I knew I was gonna miss one 😉

Page 2 of 2

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