ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Blink word in sentence

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Navarro Parker
Blink word in sentence
on Apr 5, 2013 at 10:52:52 pm

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


Return to posts index

Dan Ebberts
Re: Blink word in sentence
on Apr 6, 2013 at 12:19:01 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



Return to posts index

Navarro Parker
Re: Blink word in sentence
on Apr 6, 2013 at 9:04:05 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?


Return to posts index


Dan Ebberts
Re: Blink word in sentence
on Apr 6, 2013 at 10:24:57 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



Return to posts index

Navarro Parker
Re: Blink word in sentence
on Apr 6, 2013 at 11:00:41 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)


Return to posts index


Dan Ebberts
Re: Blink word in sentence
on Apr 6, 2013 at 11:40:10 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



Return to posts index


Navarro Parker
Re: Blink word in sentence
on Apr 7, 2013 at 12:51:07 am

cool! Thanks again


Return to posts index

Aqeel Arruhaili
Re: Blink word in sentence
on May 4, 2019 at 12:03:57 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


Return to posts index

Dan Ebberts
Re: Blink word in sentence
on May 4, 2019 at 3:38:40 pm

Try changing this line:

if (seg%2) 100 else 0

to this:

(seg%2) ? 100 : 0


Dan



Return to posts index


Aqeel Arruhaili
Re: Blink word in sentence
on May 4, 2019 at 4:49:23 pm

I got a different mistake message

Syntax Error :Unexpected token ?


Return to posts index

Dan Ebberts
Re: Blink word in sentence
on May 4, 2019 at 5:10:20 pm

What does your expression look like now?


Dan



Return to posts index

Aqeel Arruhaili
Re: Blink word in sentence
on May 4, 2019 at 9:43:07 pm

wordIndexToBlink = 3;

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

This doesn't show any mistakes but no result are seen....the word is still not blinking...


Return to posts index


Dan Ebberts
Re: Blink word in sentence
on May 4, 2019 at 9:54:13 pm

Replace this:

if (seg%2) ?100:0

with this:

(seg%2) ?100:0


Dan



Return to posts index

Aqeel Arruhaili
Re: Blink word in sentence
on May 5, 2019 at 11:07:04 am

It works .....thank you so much...


Return to posts index

Aqeel Arruhaili
Re: Blink word in sentence
on May 5, 2019 at 5:39:00 pm

What if I want to specify words themselves instead of their orders in the sentence to blink..e.g. "He is not listening to me" "He" "is" "listening"


Return to posts index


Kalleheikki Kannisto
Re: Blink word in sentence
on May 6, 2019 at 11:18:11 am

You would have to find the indices of the words in question: You can split the string to array with individual words and check each for a match to your "search" words.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

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