Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Randomised rain with expressions query

  • Randomised rain with expressions query

    Posted by Jason Guest on October 27, 2011 at 1:44 pm

    Hi All,

    A few years ago I worked on a short charity film called “Eva Goes to Foreign” https://www.youtube.com/watch?v=Syd9weX4iRQ Towards the end of the film there is a scene where it starts to rain; I made this rain simply by animating very thin (2px wide) solids down the screen at random positions across the screen. I’d now like to achieve the same effect but with expressions controlling the movement of each raindrop (I did it manually before). I’m almost there, having adapted one of the random movements expressions from Dan Ebbert’s website:

    segMin = .1; //minimum segment duration
    segMax = .3; //maximum segment duration
    minVal = 0;
    maxVal = thisComp.width;
    y = thisComp.height;

    seedRandom(index,true);
    segDur = random(segMin, segMax);

    seed = Math.floor(time/segDur);
    segStart = seed*segDur;

    seedRandom(seed,true);
    x = Math.floor(random(minVal,maxVal))
    linear(time,segStart,segStart + segDur, [x,0], [x,y]);

    Each of the raindrops is a solid the height of the comp and 2px wide with the anchor point at the bottom. What I can’t understand is why they don’t always animate from the top of the screen to the bottom; sometimes they stop before the bottom, sometimes they start some way down from the top. It looks to me as if that is exactly what this code should do – can anyone see what’s wrong?

    Jason Guest replied 14 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 27, 2011 at 2:51 pm

    I would think you’d want the vertical distance traveled to be twice the comp height:

    y = thisComp.height*2;

    Dan

  • Jason Guest

    October 27, 2011 at 4:17 pm

    Thanks, Dan, I hadn’t thought of that! Looks better now.

    – Jason

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