Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random character opacity on and off

  • Random character opacity on and off

    Posted by Matthew Boron on February 27, 2011 at 5:18 pm

    I have a text layer that I want to animate the characters on and off randomly. Does this need to be accomplished with an expression? Help is apprecieated!

    Dan Ebberts
    replied 2 years ago
    11 Members · 25 Replies
  • 25 Replies
  • Dan Ebberts

    February 27, 2011 at 9:31 pm

    Add an opacity animator and set the value to 0. Add an expression selector and delete the range selector. Add this expression to Amount:

    freq = 1;
    if (rotation.wiggle(freq,1) > 0) 100 else 0

    Adjust freq to meet your needs.


  • Matthew Boron

    February 27, 2011 at 9:50 pm

    That is excellent Dan!, Is there a way/modification to that expression so that only one character is displayed at a given time? You have been a great help!

  • Dan Ebberts

    February 28, 2011 at 2:23 am

    Something like this should work:

    freq = 1;

    txt = text.sourceText;
    curMax = -999;
    for (i = 0; i < txt.length; i++){
    w = rotation.wiggle(freq,1);
    if (w > curMax){
    curMax = w;
    idx = i;
    textIndex == idx ? 0 : 100


  • Matthew Boron

    March 1, 2011 at 2:36 am

    Perfect Dan! Thanks!

  • Ze’ev Gilad

    April 2, 2012 at 8:34 pm

    Dan, maybe you can help me…

    This is driving me nuts. I have a block of text, and need the words to randomly fade in & out over time.
    I tried various range selectors; fading IN randomly was easy, but getting them to fade in AND out has proved difficult.

    The closest thing I found was this bizarre tip from Adobe – adding an Expressions Selector with this code:

    wiggle(.1, 350);

    But this completely baffles me! Isn’t seedRandom just for reseeding the random generator?? Why does it need textIndex as input? If I change it to ANYTHING else, ALL the words are faded.

    The problem is I want to change the random order of what I’m getting! But I can’t change the random seed.


  • Dan Ebberts

    April 2, 2012 at 8:51 pm

    >Isn’t seedRandom just for reseeding the random generator??

    Yes it is.

    >Why does it need textIndex as input?

    With an expression selector, the expression get executed for each character/word. textIndex is unique for each word, so the random behavior is different. If you use the same seed for each word = same results. You could use some multiple of textIndex to get different results.


  • Ze’ev Gilad

    April 2, 2012 at 8:56 pm

    Well, that worked!
    I used seedRandom(textIndex*2) and that gave me new results, thanks!

    But I’m still totally confused how this Expression Selector works. You haven’t happened to write some excellent tutorial on the subject, have you?

    thanks again

  • Navarro Parker

    July 31, 2012 at 6:44 pm

    CS6 is telling me there is Class ‘global’ has no property or method named “textIndex”. So it breaks all these expressions.

    What can I substitute in its place?

  • Dan Ebberts

    July 31, 2012 at 6:51 pm

    textIndex is only allowed inside an Expression Selector. Apply the expression to the Amount property. It should work fine in CS6.


  • Navarro Parker

    July 31, 2012 at 11:14 pm

    Good to know. Thanks for the tip.

Page 1 of 3

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