Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random light intensity between two values

  • Random light intensity between two values

    Posted by Paul Trunkfield on October 29, 2009 at 12:56 pm

    Hi all,
    I have a scene set up where i have a 3d light randomly flickering on the subject. I have used the “Let there be light” expression from https://www.motionscript.com.

    segMin = 1.0; //minimum segment duration
    segMax = 1.5; //maximum segment duration
    flickerDurMin = .5;
    flickerDurMax = .8;

    end = 0;
    j = 0;
    while ( time >= end){
    j += 1;
    seedRandom(j,true);
    start = end;
    end += random(segMin,segMax);
    }
    flickerDur = random(flickerDurMin,flickerDurMax);
    if (time > end – flickerDur){
    seedRandom(1,false);
    random(100);
    }else{
    100
    }

    I would like to be able to set the random light intensity between two specific amounts such as 80% and 100% intensity.

    I don’t know much about expressions so any help would be really appreciated.

    Paul Trunkfield replied 16 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Kevin Camp

    October 29, 2009 at 5:13 pm

    just change the random value line where it says:

    random(100)

    to

    random(80,100)

    in the first expression, random(100), the zero is implied, so it really is saying random(0,100), changing that 0 to 80 sets the range to choose random numbers from to be between 80-100.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Paul Trunkfield

    October 29, 2009 at 6:21 pm

    Brilliant – thanks very much for your help. Works perfectly.

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