Activity › Forums › Adobe After Effects › Expression to assign a color to a letter?
-
Expression to assign a color to a letter?
Filip Vandueren replied 6 years, 1 month ago 4 Members · 16 Replies
-
Kalleheikki Kannisto
June 19, 2019 at 12:55 pmIt 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 pmInteresting!
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 pmIs 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 pmSure,
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 amWorks perfectly, Filip (just needed to change “colours” on the bottom line).
Thanks for sharing your knowledge, it’s a massive help.
Reply to this Discussion! Login or Sign Up