-
Trying to make random lines float across the screen.
I have a comp where I am putting a dozen lines, that are all the same size and anchor point. I have made them 3d and I’m trying to write a script that will start them at different y and z coordinates, but they will move from off screen right to off screen left. As they are moving I don’t want their y and z values to change, I just want random start points. The x should be a pretty consistent speed.
This is what I have so far, but I can’t figure out how to make the “y” and “z” keep the same random value from beginning to end. (I have left them in the ending value brackets just for display sake.)
segMin = .3;
segMax = .7;
minVal = [4000, 0, -500];
maxVal = [4000, thisComp.height, 500];
minEndVal = [-2000, y, z]; //How do I get the generated numbers for the y and z to be returned to here?
maxEndVal = [-2000, y, z]; //How do I get the generated numbers for the y and z to be returned to here?seedRandom(index,true);
segDur = random(segMin, segMax);
seed = Math.floor(time/segDur);
segStart = seed*segDur;
seedRandom(seed,true);
startVal = random(minVal,maxVal);
seedRandom(seed+1,true);
endVal = random(minEndVal, maxEndVal);
linear(time, segStart, segStart + segDur, startVal, endVal);Any help will be greatly appreciated.