Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Random opacity on specific way

  • Random opacity on specific way

  • Alekos Mazzolotti

    April 23, 2020 at 7:21 pm

    Please, I need help with a very specific expression. I have created this screen that is going to work as part of an intro for a series of videos.

    I want to make those green squares randomly sort of flicker, by changing the value of the opacity, but it must always go from 0 to 100 or from 100 to 0, across 1 or 2 seconds, which is not what happens if I just use a regular wiggle expression on the property.

    The behavior I need is:

    – random interval (1 to 3 seconds)
    – opacity goes from 0 to 100 in 1 or 2 seconds (30 fps)
    – random interval (1 to 3 seconds)
    – opacity goes back from 100 to 0 in 1 or 2 seconds

    I have done this manually, by adding certain keyframes and telling them to loopout. As there are too many, you can’t notice it’s a cycle and it gives the illusion of randomness. But I have to manually create this randomness using keyframes at different points for every layer, which can become an exhaustive processes if I intend to keep this line of work for other screens.

    I already have each green square on its own layer. Is there a way to make it more automatic through the use of an expression?

  • Dan Ebberts

    April 23, 2020 at 8:21 pm

    It sounds do-able, but it seems like there’s info missing. Maybe a more detailed example would help.

    Dan

  • Alekos Mazzolotti

    April 24, 2020 at 8:16 pm

    Sure!

    Here, that’s what I did manually:

    In this example, as I said, there is no real randomness, for I used keyframes and a loopout expression in a manner that created more or less the same effect.

    Can I create this behavior via expression?

  • Dan Ebberts

    April 24, 2020 at 8:53 pm

    This is a pretty simple version that might get you started:


    minFade = .1;
    maxFade = .5;
    minHold = .5;
    maxHold = 1.5;
    minDelay = 1;
    maxDelay = 1.5;
    seedRandom(index,true);
    myFade = random(minFade,maxFade);
    myHold = random(minHold,maxHold);
    myDelay = random(minDelay,maxDelay);
    myStart = random(minDelay);
    if (time > myStart){
    myPeriod = myFade*2 + myHold + myDelay;
    t =(time - myStart)%myPeriod;
    if(t < myFade)
    linear(t,0,myFade,0,100)
    else
    linear(t,myFade+myHold,myFade*2+myHold,100,0);
    }else
    0

    Dan

  • Alekos Mazzolotti

    April 25, 2020 at 6:19 pm

    Magnificent!

    It worked perfectly. Thanks a whole lot, friend!

Viewing 1 - 5 of 5 posts

Log in to reply.

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