Activity › Forums › Adobe After Effects Expressions › Expression duration help, please!
-
Expression duration help, please!
Posted by Shirak Agresta on March 16, 2006 at 10:22 amI guess this might be a question for Dan Ebberts (love your site, by the way). Anyway, I was using his “random” expression and I want to make it random for only a set duration and then after that be able to keyframe on that property like normal. Is there a way to do that without duplicating the layer and just starting it from where the expression on the first layer ends? So:
1) How do you set a duration end for a “random” expression;
2) Is there a way to still keyframe later in the timeline of a layer that has an expression on it?
Thanks in advance for the advice!
–Shirak
Julius Caesar and the Roman Empire couldn’t conquer the blue sky.
Shirak Agresta replied 20 years, 2 months ago 3 Members · 9 Replies -
9 Replies
-
Mylenium
March 16, 2006 at 10:43 amYou can use the seedRandom() method in combination with an external driver. Create an Effects -> Expression Controls -> Slider, name it “Randomizer” and then add the expression below to the property you want to animate:
randomizer=effect(“Randomizer”)(“Slider”);
seedRandom(randomizer,true);
my_random=random(-100,100);
my_value=value+my random;[my_value]
As long as the slider is animated, you will get randomeness, if it doesn’t do anything, randomnes wil be static and not change.
Mylenium
[Pour Myl
-
Dan Ebberts
March 16, 2006 at 2:17 pmSay you want the expression to only be in effect for 4 seconds. I’d just change the last line of your expression to:
result = (whatever your final result was before);
if (time > 4) result else valueThat will give you your keyframed value after the 4 seconds.
Dan
-
Shirak Agresta
March 16, 2006 at 8:30 pmOkay, cool, but bear with me, I’m really new to expressions. So:
Mylenium: After I make a slider, can I connect it to the property I want to animate if it already has an expression attached to it? Would I include my expression into the slider creation and how could I do that?
Dan: Say at a certain point of randomness I like where the say, position, is; Can I make those co-ordinates (or whatever) the “result”? Is that what you were trying to tell me? And can I ease out of the randomness expression into keyframeable attributes again?
Thank you guys so much for answering my questions, really appreciate it!!
–Shirak
Julius Caesar and the Roman Empire couldn’t conquer the blue sky.
-
Shirak Agresta
March 16, 2006 at 8:45 pmUm, I tried your expression, Mylenium, and it gave me an error at line 6 and disabled it. Is there something I’m supposed to be entering or do I use your expression line for line, word for word? Is there something that needs to go in the brackets you have designated [my_value]?
Thanks again!
Julius Caesar and the Roman Empire couldn’t conquer the blue sky.
-
Shirak Agresta
March 16, 2006 at 8:52 pmDan, this is the expression I’m using (yours from your website). How would I add on to the end of it with the expression you replied with (result…)?
Thanks.
segMin = 1.0; //minimum segment duration
segMax = 3.5; //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();
startVal = random(minVal,maxVal);
ease(time,start,end,startVal,endVal);Julius Caesar and the Roman Empire couldn’t conquer the blue sky.
-
Dan Ebberts
March 16, 2006 at 9:26 pmIf you just want it to stop where it is at a particular time, I think I’d do it this way:
myEndTime = 4;
segMin = 1.0; //minimum segment duration
segMax = 3.5; //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;
if (time < myEndTime) t = time else t = myEndTime; while ( t >= end){
j += 1;
seedRandom(j,true);
start = end;
end += random(segMin,segMax);
}
endVal = random(minVal,maxVal);
seedRandom(j-1,true);
dummy=random();
startVal = random(minVal,maxVal);
ease(t,start,end,startVal,endVal);Just set myEndTime to the time you want it to stop.
Dan
-
Shirak Agresta
March 17, 2006 at 1:28 amWow this is great! Sorry, but just one more thing. How could I get it to ease-in to the myEndTime?
Thanks, expressions still hurt my brain, but your help is helping me to understand them better!
Julius Caesar and the Roman Empire couldn’t conquer the blue sky.
-
Dan Ebberts
March 17, 2006 at 8:35 amHow would that work? There’s only a fixed time to get from the next-to-last point to the last point. If you slow that down you’ll overshoot your target time. Is that OK?
Dan
-
Shirak Agresta
March 17, 2006 at 8:44 amI guess that depending on how much it would go past the target time, I would just then compensate for that in where I placed that layer in my animation. For this particular project I’m working on, no it wouldn’t matter to much, I’d just work around it. It’s just that it’s such an abrupt stop. Is there a way to write an expression that says (for example):
when time reaches, say, 4 seconds (00;04;00) ease to a stop. Then I could change that beginning ease point to wherever I needed it on the timeline, figuring that it would overshoot and then plan for it in where I place my layer in the comp.
No? Like I said, I’m brand new to expressions, so I don’t know. I like the idea of the expression slider, but I don’t know if it could incorporate your random expression that I’m currently using and control it like that…
Either way, thanks!
Julius Caesar and the Roman Empire couldn’t conquer the blue sky.
Reply to this Discussion! Login or Sign Up