Need an expression that pauses composition playback while there is no position movement
I've got a looping composition using time remap and LoopOut.
The composition moves randomly from one position to another, then stops (for a random amount of time), then moves to another random point (like a bug crawling around).
I'm using this expression for my position:
moveMin = .3; //minimum move time
moveMax = .7; //maximum move time
pauseMin = .1; // minimum pause time
pauseMax = .5; // maximum pause time
minVal = [transform.position[0]-200, transform.position[1]-200];
maxVal = [transform.position[0]+200, transform.position[1]+200];
seedRandom(index,true); // set pre-run for endT
endT = - random(moveMax);
j = 0;
k = 0;
while ( time >= endT){
j += 1;
seedRandom(j,true);
startT = endT;
if (j%2){
endT += random(moveMin,moveMax);
k++;
}else{
endT += random(pauseMin,pauseMax);
}
}
if (j%2){
seedRandom(k,true);
endVal = random(minVal,maxVal);
seedRandom(k-1,true);
startVal = random(minVal,maxVal);
ease(time,startT,endT,startVal,endVal)
}else{
seedRandom(k,true);
random(minVal,maxVal)
}
I'm trying to have the composition pause/freeze playback while the layer is stopped.
Not really sure how to go about it. Any suggestions or help?
Thanks!
