Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression for random fade-in opacity for multiple layers

  • Expression for random fade-in opacity for multiple layers

    Posted by Al Mach on February 4, 2016 at 6:55 pm

    I’m trying to randomize a short opacity fade-in from 0 to 100 on many different layers. Basically I just want 64 different boxes to randomly fade in over 10 frames or so (i’ve broken up these layers into rows, so there are 8 pre comps with 8 layers each). I’ve tried searching for the answer but seems like all of the posts are about randomly turning opacity on and off. I just want a simple fade-in,

    Any help would be much appreciated!

    Al Mach replied 7 years, 11 months ago 2 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    February 5, 2016 at 4:22 am

    Play around with this and see if it’s close to what you’re looking for:

    fadeDuration = thisComp.frameDuration*10;
    maxDelay = .5;
    seedRandom(index,true);
    delay = random(maxDelay);
    t = time -(inPoint + delay);
    linear(t,0,fadeDuration,0,100)

    Dan

  • Al Mach

    October 1, 2018 at 11:02 pm

    I’m returning to this message because I have to use this expression again, except to randomly fade opacity from 100 to 0. For some reason, the expression above is not randomizing the layers (all the laters are fading at the same time. Can you help?

    Thanks in advance.

  • Dan Ebberts

    October 1, 2018 at 11:21 pm

    It works for me if I change the last line to:

    linear(t,0,fadeDuration,0,100)

    Dan

  • Al Mach

    October 1, 2018 at 11:25 pm

    So this is the expression I’m using:

    fadeDuration = thisComp.frameDuration*10;
    maxDelay = .5;
    seedRandom(index,true);
    delay = random(maxDelay);
    t = time -(inPoint + delay);
    linear(t,0,fadeDuration,100,0)

    The last line has the opacity going to 0, because this is what I need in this animation. Unfortunately it’s not randomizing like I need it to (all the layers are fading out at the exact same time). Can you help with this?

  • Dan Ebberts

    October 2, 2018 at 12:36 am

    That should work unless the expression is inside a precomp and you’re duplicating the precomp layer.

    Dan

  • Al Mach

    October 2, 2018 at 5:48 pm

    Then expression is on a slider, and the layers below (vector layers from Illustrator) are linked to the slider (their opacity). The opacity is working, just not the randomness. I don’t understand what I’m doing wrong. I’ve attached a screenshot to show you how the opacities of the different layers are fading at exactly the same time.

  • Dan Ebberts

    October 2, 2018 at 6:10 pm

    If you want the timing to be different for each layer, you’d have to apply the expression to each layer’s opacity property, not link them all to the same slider.

    Dan

  • Al Mach

    October 2, 2018 at 6:24 pm

    Amazing, thanks so much!

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