ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Randomly move position of layer on Y within a range, hold for a few frames and move again

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nawaz Alamgir
Randomly move position of layer on Y within a range, hold for a few frames and move again
on May 17, 2019 at 1:58:30 pm

I found this code
Random position in a random amount of time and pause in this position for a random amount of time
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)
}


But just want this for the Y position of a layer only

Dan, can you help if you have a sec? Many Thanks


Return to posts index

Nawaz Alamgir
Re: Randomly move position of layer on Y within a range, hold for a few frames and move again
on May 17, 2019 at 2:05:48 pm

I figured out a method that words , and made this change to the expression


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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]