ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Opacity semi-random issue

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Trevor Navarre
Opacity semi-random issue
on Jan 15, 2018 at 8:59:55 pm

I have a displacement map I would like to flicker on and off randomly, however I would like it to be off more that on and only be on a few times rather than a majority.

Here's what I came up with :


random(0,100);
if (thisComp.layer("displace").transform.opacity < 90) 0 else 100;


It doesnt seem to randomize once I put all of this in.... any help would be appreciated. Also if there is a way that when it does switch "on" it stays on for maybe 10 frames I'd appreciate a hint on that! Thanks in advance for any help!

random(0,100);
if (thisComp.layer("displace").transform.opacity &lt; 90) 0 else 100;


Return to posts index

Kevin Camp
Re: Opacity semi-random issue
on Jan 15, 2018 at 9:13:07 pm

you're close... you just need to assign the random value to a variable and compare that variable to 90 to set the opacity....

r = random( 0, 100 ) ;
if ( r < 90 ) 0 else 100 ;

note, if the less than sign gets replaced with < manually replace it with the symbol.

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

Trevor Navarre
Re: Opacity semi-random issue
on Jan 15, 2018 at 9:20:47 pm

Thanks! Seems to be working!


Return to posts index


Trevor Navarre
Re: Opacity semi-random issue
on Jan 15, 2018 at 10:49:40 pm

This is kind of primative but below is what I'm trying to do but just unable to articulate. Any clue?

r = random( 0, 100 ) ;
if ( r &lt; 90 ) 0 else 100 ;
if (r = 100) (r = 100 for 8 frames)


Return to posts index

Kevin Camp
Re: Opacity semi-random issue
on Jan 16, 2018 at 6:32:41 pm

you could try using posterizeTime() to have a new random value generated every 8 frames (instead of every frame):

hold = 8 ; // value in frames
fps = 1 / thisComp.frameDuration / hold ;
posterizeTime( fps ) ;
r = random( 0, 100 ) ;
if ( r < 90 ) 0 else 100 ;

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

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