Creative Communities of the World Forums

The peer to peer support community for media production professionals.

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

  • Rod Duarte

    June 13, 2022 at 9:42 am

    Hey guys!
    I’m using this for a project I’m working on.
    I just need to better understand it, so I can tweak.

    The idea here is, there’s one creature with multiple different item sets and skins, and I need them to pop in and out but it needs to be an either/or thing, instead of them showing up overlapping each other.
    It’s going to be a challenge thing where the user needs to pause it at the right moment with it looking exactly correct with a specific skin and item set.
    If I just slap this expression on everything, I get this (attached).

  • Rod Duarte

    June 13, 2022 at 9:56 am

    Hi guys!
    Is there a way to do this, but have layers show exclusively?
    As in, if I’m running this code on all layers, I also need to have it so only one layer shows at a time, and they never overlap.

    Possible?

  • Dan Ebberts

    June 13, 2022 at 6:37 pm

    I don’t think that expression would be the best choice for what you’re doing. Assuming that all layers in your comp are participating, I’d add a new null layer (named “controls”) with a slider control and move it to the bottom of the layer stack. You would then add this expression to the slider:

    minDur = .1;

    maxDur = .5;

    n = index-1;

    seedRandom(index,true);

    curTime = 0;

    curIdx = Math.floor(random(n));

    while (curTime <= time){

    curTime += random(minDur,maxDur);

    curIdx = (curIdx + Math.floor(random(1,n)))%n;

    }

    curIdx + 1

    This expression publishes the layer index of the layer to be visible at any given time. Adjust minDur and maxDur to set the range of times each layer is visible. Then, on all the participating layers, you would add this opacity expression:

    s = thisComp.layer("controls").effect("Slider Control")("Slider");

    s == index ? 100 : 0

  • Dan Ebberts

    June 14, 2022 at 1:03 am

    Rather than start with that expression, I think I’d take a different approach.

    Assuming that all layers in your comp are participating in this random lottery, you could add a new null layer (named “controls”) with a slider contol and move it to the bottom of the layer stack. You would then add this exression to the slider:

    minDur = .1;

    maxDur = .5;

    n = index-1;

    seedRandom(index,true);

    curTime = 0;

    curIdx = Math.floor(random(n));

    while (curTimeRather than start with that expression, I think I’d take a different approach.

    Assuming that all layers in your comp are participating in this random lottery, you could add a new null layer (named “controls”) with a slider contol and move it to the bottom of the layer stack. You would then add this exression to the slider:

    minDur = .1;

    maxDur = .5;

    n = index-1;

    seedRandom(index,true);

    curTime = 0;

    curIdx = Math.floor(random(n));

    while (curTime

Page 2 of 2

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