ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Random character opacity on and off

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Matthew BoronRandom character opacity on and off
by on Feb 27, 2011 at 5:18:30 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!


Return to posts index

Dan EbbertsRe: Random character opacity on and off
by on Feb 27, 2011 at 9:31:34 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;
seedRandom(textIndex,true);
if (rotation.wiggle(freq,1) > 0) 100 else 0

Adjust freq to meet your needs.

Dan



Return to posts index

Matthew BoronRe: Random character opacity on and off
by on Feb 27, 2011 at 9:50:55 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!


Return to posts index



Dan EbbertsRe: Random character opacity on and off
by on Feb 28, 2011 at 2:23:49 am

Something 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



Return to posts index

Matthew BoronRe: Random character opacity on and off
by on Mar 1, 2011 at 2:36:34 am

Perfect Dan! Thanks!


Return to posts index

Navarro ParkerRe: Random character opacity on and off
by on Jul 31, 2012 at 6:44:31 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?


Return to posts index


Dan EbbertsRe: Random character opacity on and off
by on Jul 31, 2012 at 6:51:44 pm

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

Dan



Return to posts index

Navarro ParkerRe: Random character opacity on and off
by on Jul 31, 2012 at 11:14:01 pm

Good to know. Thanks for the tip.


Return to posts index

Ze'ev GiladRe: Random character opacity on and off
by on Apr 2, 2012 at 8:34:39 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:

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!


Return to posts index


Dan EbbertsRe: Random character opacity on and off
by on Apr 2, 2012 at 8:51:16 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



Return to posts index

Ze'ev GiladRe: Random character opacity on and off
by on Apr 2, 2012 at 8:56:43 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


Return to posts index

Gage UllmanRe: Random character opacity on and off
by on Jan 9, 2017 at 10:23:30 pm

This is fairly similar to something I'm trying to do and can't seem to figure out... I'm trying to have the letters flicker on left to right, but with a degree of randomness. So, you know, if the letters are ABCDEFG, A flickers on and then maybe C starts, and then B and D go so on with a slight randomness until the word is completed. I thought I had it using one of your expressions from motionscript.com (random text overshoot), but I can't seem to get the left-to-rightness of it to work. That make sense? Sorry to tack onto an old thread like this, I just haven't been able to find quite the thing I'm looking for.


Return to posts index


Adam GoddardRe: Random character opacity on and off
by on Aug 5, 2015 at 12:55:37 am

Hi Dan

I am trying to get this expression to work on a text layer, applying the expression to the opacity animator. I am getting the following error message:

property or method named 'textindex' in Class 'global' is missing or does not exist...

Can you please help solve this?

Many thanks
Adam.


Return to posts index

Dan EbbertsRe: Random character opacity on and off
by on Aug 5, 2015 at 1:12:21 am

You must have missed the step where you add the Expression Selector. The Amount property of an Expression Selector is the only place where that expression won't generate an error.


Dan



Return to posts index

Adam GoddardRe: Random character opacity on and off
by on Aug 5, 2015 at 1:19:30 am

ahhh quite correct. many thanks and apologies for missing that and not reading close enough.

Adam


Return to posts index

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