Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Controlling frequency of” 0 or 100 opacity” expression

  • Controlling frequency of” 0 or 100 opacity” expression

    Posted by Nicholas Roy on August 20, 2018 at 10:49 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.

    Nicholas Roy replied 8 years ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    August 20, 2018 at 11:46 pm

    Something like this maybe:

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

    Dan

  • Nicholas Roy

    August 21, 2018 at 3:52 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?

  • Dan Ebberts

    August 21, 2018 at 3:57 pm

    Now you’re venturing into much more complex territory:

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

    Dan

  • Nicholas Roy

    August 21, 2018 at 4:26 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:

    https://lesterbanks.com/2012/02/creating-an-on-off-expression-in-after-effects/

    Thanks Dan you the man.

  • Dan Ebberts

    August 21, 2018 at 5:10 pm

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

    Dan

  • Nicholas Roy

    August 21, 2018 at 10:14 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

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