# Creative Communities of the World Forums

The peer to peer support community for media production professionals.

• # Blink word in sentence

Posted by on April 5, 2013 at 10:52 pm

How could you make an individual word in a sentence blink? I’m thinking using the text word index?

4 Members · 15 Replies
• 15 Replies
• ### Dan Ebberts

April 6, 2013 at 12:19 am

One way:

Add an Opacity Animator and set the Opacity value to 0.
Add an Expression Selector and delete the Range Selector.
Set the Based On parameter to “Words”
Add an expression like this to Amount parameter:

``` wordIndexToBlink = 3; freq = 1;```

``` ```

```if (textIndex == wordIndexToBlink){ seg = Math.floor((time - inPoint)*freq*2); if (seg%2) 100 else 0 }else 0 ```

Dan

• ### Navarro Parker

April 6, 2013 at 9:04 pm

Works like a charm! Thanks! I didn’t even know text had a parameter for expressions like that.

Would it be possible to add a “blink x number of times, then stay solid” feature into that?

• ### Dan Ebberts

April 6, 2013 at 10:24 pm

Like this:

``` wordIndexToBlink = 3; numBlinks = 5; freq = 1; if (textIndex == wordIndexToBlink){ seg = Math.floor((time - inPoint)*freq*2); if (seg < numBlinks*2) if (seg%2) 100 else 0 else 0 }else 0 ```

Dan

• ### Navarro Parker

April 6, 2013 at 11:00 pm

Ok, I’m impressed! So cool!

Just curious is it possible for wordIndexToBlink to contain more than one value?

Like:

wordIndexToBlink = 1,5 (words 1 and 5)
or
wordIndexToBlink = 2~4 (words 2 through 4)

• ### Dan Ebberts

April 6, 2013 at 11:40 pm

One way:

``` wordIndexToBlink = [2,3,4]; numBlinks = 5; freq = 1; blinkMe = false; for (i = 0; i < wordIndexToBlink.length; i++){ if (wordIndexToBlink[i] == textIndex){ blinkMe = true; break; } } if (blinkMe){ seg = Math.floor((time - inPoint)*freq*2); if (seg < numBlinks*2) if (seg%2) 100 else 0 else 0 }else 0 ```

Dan

• ### Navarro Parker

April 7, 2013 at 12:51 am

cool! Thanks again

• ### Aqeel Arruhaili

May 4, 2019 at 12:03 pm

I am using after effects 2019 but when I used the expressions mentioned here..i got a wrong message and I couldn’t solve it…
Syntax Error: Unexpected token else

• ### Dan Ebberts

May 4, 2019 at 3:38 pm

Try changing this line:

if (seg%2) 100 else 0

to this:

(seg%2) ? 100 : 0

Dan

• ### Aqeel Arruhaili

May 4, 2019 at 4:49 pm

I got a different mistake message

Syntax Error :Unexpected token ?

• ### Dan Ebberts

May 4, 2019 at 5:10 pm

What does your expression look like now?

Dan

Page 1 of 2

We use anonymous cookies to give you the best experience we can.