-
Random ease between two values with minimum and maximum on-off times
I’m exploring ways to have a property randomly ease between two values, but with a several controlling factors built in. I’ve used this expression from Dan Ebberts before, which works great for creating random blinking between two values (in this case, 0 and 100), using slider controls to determine the minimum and maximum on times, and minimum and maximum off times. What I can’t figure out is how to modify the expression to make it ease between the two values over a set amount of time.
For example, if there was a slider control named “easeDuration” that was set to 0.5, then every time the property goes from 0 to 100, I’d like it ease from 0 to 100 over a period of 0.5 seconds, and then when it goes back to 0, it would do so over a period of 0.5 seconds.
I’ve tried many times to wrap my head around all of Dan’s brilliant articles on expressions, but my brain can only follow up to a certain point. Any help is greatly appreciated!minOnTime = effect("Minimum On Time")("Slider");
maxOnTime = effect("Maximum On Time")("Slider");
minOffTime = effect("Minimum Off Time")("Slider");
maxOffTime = effect("Maximum Off Time")("Slider");
i = 0;
tEnd = 0;
seedRandom(index,true);
preRun = random(maxOnTime);
while (time + preRun >= tEnd){
i++;
if(i%2){
tEnd += random(minOnTime,maxOnTime);
result = 100;
}else{
tEnd += random(minOffTime,maxOffTime);
result = 0;
}
}
resultAfter Effects Templates – digital glitch effects, 80s VHS effects, old film effects, art effects, and more: https://CreationEffects.com