Author: Sundstedt Animaton
Applied to an eye blink slider control (rigged with Joysticks ‘n Sliders) generates random blinks between the open and closed values (0,100).
Code Sample
Hover over the code and click the copy button.
minSeg = 1; // shortest interval between blinks
maxSeg = 3.0; // longest interval between blinks
blinkDur = .25;
fadeTime = .1;
seedRandom(index,true);
segStartTime = -random(minSeg,maxSeg);
segEndTime = segStartTime;
i = 1;
while (time >= segEndTime){
i += 1;
seedRandom(i,true);
segStartTime = segEndTime; segEndTime = segEndTime + random(minSeg,maxSeg);
}
if (time < segStartTime + blinkDur/2) {easeOut(time,segStartTime,segStartTime+fadeTime,0,100)}
else {easeIn(time,segStartTime+blinkDur-fadeTime,segStartTime+blinkDur,100,0)
}