-
Random motion gradually going back to the original location
Hello!
I have been using AE for quite some time and I am finally starting to use expressions.
I have a group of objects on the stage and I want to move them around randomly( (like a bunch of ants moving around), then they start moving around smaller area and eventually going back to the original location. I thought of using wiggle and simply control the values in keyframes but the problem is that wiggling is like flashing element in which each object jumps from one point to the other instead of actually “moving”.
So, I found this code which allows me to create random motion. But the problem is that I don’t know how I can gradually decrease/limit the movement to go back to the original location. Here is what I have so far.
If you have tips of how I can modify this code I would really appreciate it. Thank you!
Yoshiko
tMin = .25; //minimum segment duration
tMax = 1.5; //maximum segment duration
minVal = [0.1*thisComp.width, 0.1*thisComp.height];
maxVal = [0.6*thisComp.width, 0.6*thisComp.height];
end = 0;
j = 0;
while (time >= end){
j ++;
seedRandom(j,true);
start = end;
end += random(tMin,tMax);
}
endVal = random(minVal,maxVal);
seedRandom(j-1,true);
dummy = random(); //this is a throw-away value
startVal = random(minVal,maxVal);
ease(time,start,end,startVal,endVal)