ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Making every other word in a paragraph different colors

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Greg Radcliffe
Making every other word in a paragraph different colors
on Feb 26, 2011 at 11:21:23 pm

Hello,

I'm new to AE Expressions but familiar with MEL/Python/Java. It's hard for me to figure out the correct syntax to make AE happy. Here's the goal, to take a list of 900+ words and alternate each word between two fill colors. I have all the text in one main paragraph and using Text Animator with an Expression Selector should work.

The code below is my lame attempt. I have my colors and I'm trying to use the textIndex of the Expression Selector to find the words in the paragraph. I want to see if the textIndex is even/odd then apply one of the colors, otherwise the other color.

I believe I'm close but if there's an easier way please explain.

blueColor = [27,101,105]
peachColor = [234,109,85]

if ((textIndex % 2) = 0)
{
textIndex = blueColor
}
else
{
textIndex = peachColor
}


Return to posts index

Dan Ebberts
Re: Making every other word in a paragraph different colors
on Feb 27, 2011 at 6:11:28 am

Set the text color to blue and your fill animator to peach and try this with your expression selector:

words = text.sourceText.substr(0,textIndex).split(" ");
words.length % 2 == 0 ? 0 : 100


Dan



Return to posts index

Kjetil Svendsen
Re: Making every other word in a paragraph different colors
on Apr 5, 2017 at 11:31:59 am

What if I just wanted to set an array of numbers representing words in a sentence, and color them?

I.e. I want to set a guide layer to contain a comma-separated number list.
Let's say 1,3,5.
Based on this list, the output of a sentence should color word 1, 3 and 5.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]