ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Controlling frequency of" 0 or 100 opacity" expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nicholas Roy
Controlling frequency of" 0 or 100 opacity" expression
on Aug 20, 2018 at 10:49:47 pm

Hello folks,
I've been noddling different approaches to achieving this and can't seem to get it right.

I have multiple layers. I'd like their opacity to randomly flicker on/off so 0/100 (nothing in between)

Thats easy enough using:

Math.round(random())*100

Now I would like to ramp up the frequency of the on state by time (so at 0 seconds have everything be off, 1 second 20% is flickering on, 2 seconds 50% is on, etc.).

I'd love to do this with a slider whereas I could set a nice curve to the ramp. Any insight would be greatly appreciated. Thank you.


Return to posts index

Dan Ebberts
Re: Controlling frequency of" 0 or 100 opacity" expression
on Aug 20, 2018 at 11:46:22 pm

Something like this maybe:

s = effect("Slider Control")("Slider").value;
random(100) < s ? 100 : 0


Dan



Return to posts index

Nicholas Roy
Re: Controlling frequency of" 0 or 100 opacity" expression
on Aug 21, 2018 at 3:52:49 pm

Dan that works exactly as I requested. Problem is it gave me a seizure. I'm wondering if there is a way to do this same effect using the wiggle expression. So if I had a wiggle with both frequency and amount controlled by a slider with an or/else function to always deliver either 0 or 100?


Return to posts index


Dan Ebberts
Re: Controlling frequency of" 0 or 100 opacity" expression
on Aug 21, 2018 at 3:57:08 pm

Now you're venturing into much more complex territory:

http://www.motionscript.com/articles/speed-control.html#wiggle


Dan



Return to posts index

Nicholas Roy
Re: Controlling frequency of" 0 or 100 opacity" expression
on Aug 21, 2018 at 4:26:59 pm

I've been trying really really hard to avoid reading that. It also gives me seizures. But I have the time today to try and learn so here goes.

I've also got a 1/2 way decent shortcut working using this workaround:

http://lesterbanks.com/2012/02/creating-an-on-off-expression-in-after-effec...

Thanks Dan you the man.


Return to posts index

Dan Ebberts
Re: Controlling frequency of" 0 or 100 opacity" expression
on Aug 21, 2018 at 5:10:02 pm

You should be fine as long as you don't try and animate the wiggle frequency.

Dan



Return to posts index


Nicholas Roy
Re: Controlling frequency of" 0 or 100 opacity" expression
on Aug 21, 2018 at 10:14:07 pm
Last Edited By Nicholas Roy on Aug 21, 2018 at 10:15:54 pm

So the effect I was going for was to have multiple layers slowly begin to blink ON (0 or 100 opacity no in between), then I wanted the ON state to increase in frequency finally having them all hold ON after 5 seconds.

Ok so I'm no Dan Ebberts. Legend. But this is what I came up with and it works and gives me some control. It's a basic wiggle expression with an if/else function tied to 3 slide controllers.

code:

freq = thisComp.layer("slider").effect("frequency")("Slider")
amp = thisComp.layer("slider").effect("amount")("Slider")
control = thisComp.layer("slider").effect("control")("Slider")

if (wiggle(freq, amp) + control < 1) { 0 } else 100


Return to posts index

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