Page 1 of 1

Random move & pause URGENT

Posted: Fri Jan 15, 2010 1:40 pm
by )orgen
Hi, looking for a script that will:

Move a layer to a new random position in a random amount of time and pause in this position for a random amount of time. Then move to the next random position and so on... All the max/min random values should be set in separate variables.

Could the script below be modified to do this? or any other scripts that might work would be hugely appreciated as Im doing a crazy long booring presentation over the next couple of days and need something that will spice it up a bit.. please help!!

RANDOM MOVEMENT
http://www.motionscript.com/mastering-e ... dom-1.html

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];

end = 0;
j = 0;
while ( time >= end){
j += 1;
seedRandom(j,true);
start = end;
end += random(segMin,segMax);
}
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)

Re: Random move & pause URGENT

Posted: Fri Jan 15, 2010 4:57 pm
by Dan Ebberts
I think this expression does what you want.

moveMin = .3; //minimum move time
moveMax = .7; //maximum move time

pauseMin = .1; // minimum pause time
pauseMax = 5.; // maximum pause time

minVal = [0.1*thisComp.width, 0.1*thisComp.height];
maxVal = [0.9*thisComp.width, 0.9*thisComp.height];

endT = 0;
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)
}


Dan

Re: Random move & pause URGENT

Posted: Sat Jan 16, 2010 2:50 am
by )orgen
...how is it possible for one person to do so much good? THANKS MATE!!

the presentation I'm doing for this advertising awards has a 60 minute voice over along with some dead boring still charts on the most effective advertising...I told them there are probably going to have to pay for therapy after putting people through this, but they refuse to listen to common sense...at least I can now impress the audience with some serious random action :D They will still need professional help though.

Re: Random move & pause URGENT

Posted: Sat Jan 16, 2010 10:38 am
by Dan Ebberts
Sorry to hear about the potential mental health issues of your audience!

Here's a version that's a little better. I put in a random pre-run so that if you use this on multiple layers, they aren't all synchronized at the start.

moveMin = .3; //minimum move time
moveMax = .7; //maximum move time

pauseMin = .1; // minimum pause time
pauseMax = .5; // maximum pause time

minVal = [0.1*thisComp.width, 0.1*thisComp.height];
maxVal = [0.9*thisComp.width, 0.9*thisComp.height];

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)
}



Dan

Re: Random move & pause URGENT

Posted: Fri Oct 27, 2017 4:50 am
by martinstacey
Is there a way to add the position of the actual layer to this, so you can reposition the layers by hand?