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 pmI 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, 6 months ago 11 Members · 25 Replies -
25 Replies
-
Dan Ebberts
February 27, 2011 at 9:31 pmAdd 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;
seedRandom(textIndex,true);
if (rotation.wiggle(freq,1) > 0) 100 else 0Adjust freq to meet your needs.
Dan
-
Matthew Boron
February 27, 2011 at 9:50 pmThat 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 amSomething like this should work:
freq = 1;txt = text.sourceText;
curMax = -999;
for (i = 0; i < txt.length; i++){
seedRandom(i,true);
w = rotation.wiggle(freq,1);
if (w > curMax){
curMax = w;
idx = i;
}
}
textIndex == idx ? 0 : 100
Dan
-
Ze’ev Gilad
April 2, 2012 at 8:34 pmDan, 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:
seedRandom(textIndex);
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.
Thanks!
-
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.
Dan
-
Ze’ev Gilad
April 2, 2012 at 8:56 pmWell, 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 pmCS6 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 pmtextIndex is only allowed inside an Expression Selector. Apply the expression to the Amount property. It should work fine in CS6.
Dan
Reply to this Discussion! Login or Sign Up