-
Randomised rain with expressions query
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?