-
Move layer from fixed position to random position, within range
Hey all,
Got an expression problem I can’t quite wrap my head around.
I’ve got an animation where groups of people icons are multiplying exponentially. It’s getting complex very quickly, and I’d love to help automate my workflow a little and let the expressions do the heavy lifting. I’m close, but haven’t quite gotten it working. Figured I’d see if anyone else might be able to take a stab at this.
The layers in question spawn at [0,35,0], then need to move, over 30 frames beginning at the layer’s in point, to [random (-30,30), 35, random (-20,-80)], where it will stay for the rest of the comp.
I’ve gotten results somewhat close to what I need by adapting parts of this original expression from Motionscript:
segMin = .3; //minimum segment duration
segMax = .7; //maximum segment duration
minVal = [0.1*thisComp.width, 0.1*thisComp.height];
maxVal = [0.9*thisComp.width, 0.9*thisComp.height];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(minVal,maxVal);
ease(time,segStart,segStart + segDur, startVal, endVal);…But that’s designed to repeat. Expressions dealing with time have always somewhat tripped me up, and I can’t seem to figure out what I’m missing.
I’d love to be able to tie each random min/max value to a respective master slider, allowing me to easily control the density of this crowd. I can’t imagine a way to build an expression without still having that pickwhip option, but thought I’d make it known, at least.
Any suggestions?
EDIT: I’ve got this ALMOST working, by using the “Separate XYZ Position” Preset, and applying this to one dimension:
seedRandom(index,true);
segDur = 1;
seed = index;
segStart = inPoint;
seedRandom(seed,true);
startVal = 0;
seedRandom(seed+1,true);
endVal = effect(“X value”)(“Slider”);
ease(time,segStart,segStart + segDur, startVal, endVal);Being able to compile all dimensions into one position expression would be nice, though.
============================
Kyle Hamrick
Editor/Motion Graphics Artist