ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

overiding an expression after x secs

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Michael Goldberg
overiding an expression after x secs
on Aug 11, 2009 at 12:07:16 pm

Hi,
I've used some of Dan Ebbert's great resources on Motion Script.com, and have an expression to randomly move an object along it's Y axis. I'd like to have the randomness stop after say 4 sec's and have the layer move to it's fixed position. Is there a way to override the expression without using separate layers?
Here is the expression I used.

Mike


segMin = .3; //minimum segment duration
segMax = .3; //maximum segment duration
minVal = -500;
maxVal = 200;

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





Return to posts index

Ben Heusner
Re: overiding an expression after x secs
on Aug 11, 2009 at 8:39:38 pm

You could add a Slider Control effect and keyframe that from 100 to 0. Just tweak your expression to:

segMin = .3; //minimum segment duration
segMax = .3; //maximum segment duration
minVal = -5*effect("Slider Control")("Slider");
maxVal = 2*effect("Slider Control")("Slider");


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


That will give you the control you want.

Cheers,
Ben

Curious Turtle Pro Video
Training | Editing | Support


Return to posts index

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