Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random expression between 0 and 100, not 0-100.

  • Random expression between 0 and 100, not 0-100.

    Posted by Mikko Kovasiipi on August 9, 2011 at 12:26 pm

    Hello.

    I need to do some camera flashes and I’m using just a regular Lens Flare plug-in for that. Now I would like to do some random expression for the Flare Brightness. I would like the brightness to be either 0 or 100, not between 0-100. And also the interval to be something between 0.5 seconds and 2 seconds. Any ideas for that?

    I have also done one expression for the position of the flare like this:
    holdTime = .5;
    seed = Math.floor(time/holdTime);
    seedRandom(seed,true);
    random([thisComp.width,thisComp.height]);

    But the interval for this is 0.5 seconds and I would like that to be also something between 0.5 and 2 seconds. Not always the same 0.5.

    I would really appreciate if someone could help me with this.

    Thanks.

    Mikko K.

    Dan Ebberts replied 14 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    August 9, 2011 at 4:11 pm

    Try this:


    flashFrames = 2;
    minInt = .5;
    maxInt = 2;
    seedRandom(index,true);
    t0 = t1 = -random(maxInt);
    while (t1 <= time){
    t0 = t1;
    t1 += random(minInt,maxInt);
    }
    time <= (t0 + framesToTime(flashFrames)) ? 100 : 0

    Dan

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