Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Random Wiggle Opacity from 100% to 0%

  • Random Wiggle Opacity from 100% to 0%

  • Kuba Lu

    June 19, 2013 at 5:02 pm

    Hi guys,

    I have a picture of a night cityscape with loads of buildings. I basically need to switch of all the lights in the city. The scene is 12 seconds long and the lights need to go off randomly throughout the whole city. I masked all the windows (and there are hundreds and hundreds of them) and I’m trying to figure out how to do the job without doing it manually.

    Does any of you know an expression that would randomly change the Mask Opacity from 100% to 0%?

    I found few expressions that make the layers blink but I couldn’t find any that would knock down the opacity to 0 and make it stay there.

    Thanks!

    Kuba

  • Dan Ebberts

    June 19, 2013 at 5:14 pm

    Something like this should work:

    wiggle(1,100) < 100 ? 0 : 100

    Dan

  • Kuba Lu

    June 19, 2013 at 5:18 pm

    It still makes it flicker

    hmm…

  • Dan Ebberts

    June 19, 2013 at 5:23 pm

    sorry, I misunderstood. Try this one:

    seedRandom(index,true);
    if (time > random(thisComp.duration)) 0 else 100

    Dan

  • Kuba Lu

    June 19, 2013 at 5:30 pm

    Jeez !!!

    That works. Thanks so much Dan!

    Do you know if it’s possible to change the opacity across 4 frames so it fades out ?

    Cheers !

    Kuba

  • Dan Ebberts

    June 19, 2013 at 5:37 pm

    This should work:

    seedRandom(index,true);
    t = random(thisComp.duration);
    ease(time,t,t+thisComp.frameDuration*4,100,0)

    Dan

  • Kuba Lu

    June 20, 2013 at 9:21 am

    You’re a genius !

  • Reynoud van der Molen

    February 26, 2018 at 5:10 pm

    Hi Dan,

    I saw the incredible handy expression you created for Kuba, and I used for a similair project with a skyline and a bunch of layers.
    Now the project is evolving and I was wondering, since I am fairly new to expressions in AE, is there a easy add to let the opacity wiggle between 100% and 0% at multiple random moments.
    So to more clear: it would not just turn on or off once, but sometimes it would turn on and some times it would turn on, randomly. Or if it is easier with an predetermined frequency I can alter?

    Kind Regards,

    Reynoud
    Studio NOUD

  • Pierrick Allan

    September 29, 2019 at 7:30 am

    Hello, and thank you for the amazing help.

    the expression “wiggle(1,100) < 100 ? 0 : 100” is what i was looking for, but it’s a bit brutal. How can I add smoothing to it? For it to change from 0 to 100 and vice versa but with 4 frames of transition?

    I’ve tried to add something like seedRandom(time*5); but it doesn’t work

    Thank you so much for your help,
    Best,
    Pierrick

  • Dan Ebberts

    September 29, 2019 at 4:48 pm

    Try this:


    fadeTime = framesToTime(4);
    curState = wiggle(1,100) < 100;
    t = thisComp.frameDuration
    while (curState == wiggle(1,100,1,0.5,time-t) < 100){
    t += thisComp.frameDuration;
    }
    tt = time -t;
    if (curState){
    linear(time,tt,tt+fadeTime,100,0);
    }else{
    linear(time,tt,tt+fadeTime,0,100);
    }

    Dan

Viewing 1 - 10 of 15 posts

Log in to reply.

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