Skip to main content
Participant
May 15, 2025
Answered

SeedRandom expression, how to stop it? from Dan Ebbert's tutorial

  • May 15, 2025
  • 1 reply
  • 390 views

Hi,

 

I'm applying Dan Ebbert's values from his tutorial to use SeedRandom here below.
I applied it to an amount of dots forming a letter.
The random movement of each dot is perfect, but I want to control time and make it stop to the initial position (letter formed by dots).
Also interested to start from the letter formed, to a SeedRandom movement, than back to initial position.

Any clues to get it?

Thanks a lot for your help

segMin = .3; //minimum segment duration
segMax = .7; //maximum segment duration
minVal = 0;
maxVal = thisComp.width;

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);
y = position[1];
ease(time,start,end,[startVal,y],[endVal,y])
 

 

Correct answer Dan Ebberts

I think this version will do it. It has a new variable, totalDur, after which the animation will settle back to the original value:

segMin = .3; //minimum segment duration
segMax = .7; //maximum segment duration
minVal = 0;
maxVal = thisComp.width;
totalDur = 5; // length of animation

start = end = 0;
j = 0;
prevTarget = target = value[0];
while (time >= end){
  prevTarget = target;
  seedRandom(j,true);
  target = random(minVal,maxVal);
  start = end;
  end += random(segMin,segMax);
  if (end > totalDur) target = value[0];
  j++;
}
y = value[1];
ease(time,start,end,[prevTarget,y],[target,y]);

 

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
May 15, 2025

I think this version will do it. It has a new variable, totalDur, after which the animation will settle back to the original value:

segMin = .3; //minimum segment duration
segMax = .7; //maximum segment duration
minVal = 0;
maxVal = thisComp.width;
totalDur = 5; // length of animation

start = end = 0;
j = 0;
prevTarget = target = value[0];
while (time >= end){
  prevTarget = target;
  seedRandom(j,true);
  target = random(minVal,maxVal);
  start = end;
  end += random(segMin,segMax);
  if (end > totalDur) target = value[0];
  j++;
}
y = value[1];
ease(time,start,end,[prevTarget,y],[target,y]);

 

Participant
May 16, 2025

Oh !

 

Thank you so much.
It works fine.
I'm gonna try to play with values.

Thanks a lot