Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions switching AE Layers randomly on (within a given time)

  • switching AE Layers randomly on (within a given time)

    Posted by Baba Luba on February 18, 2019 at 12:51 pm

    Im looking for a Script witch set the opacity of a layer randomly to 100% (starting with 0)
    I found this within the forums:

    —————————-
    holdTime = .5; //time to hold each position (seconds)
    seed = Math.floor(time/holdTime);
    seedRandom(seed,true);
    hmm = random(0,10);
    if (hmm >5){
    transform.opacity=100};
    else {transform.opacity=0};

    its kind of what I want, but I want the layers to stay on.
    ——————————-

    If I could make a wish it should do this:

    switch the opacity of a layer on within a given time (a variable) say a second (randomly within this second switch on)

    then stay on for a given time (3,5,10 sek another variable)

    than switch back off within a given time

    on within a second
    stay on for 5 sekonds
    off after (in this case) 6 seconds within a second
    together 7 seconds

    any idea, I’m not good at coding ;O)

    Baba Luba replied 7 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 18, 2019 at 1:56 pm

    This might be close:


    minOnTime = 0;
    maxOnTime = 1;
    holdTime = 3;
    minOffTime = 0;
    maxOffTime = 1;
    seedRandom(index,true);
    onTime = random(minOnTime,maxOnTime);
    offTime = random(minOffTime,maxOffTime);
    if (time < onTime){
    0;
    }else if (time < onTime+holdTime+offTime){
    100;
    }else{
    0;
    }

    Dan

  • Baba Luba

    February 18, 2019 at 3:47 pm

    thank you very much !!!

    I just tried it and it seems to work
    very much appreciated

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