[Christopher Sean] “I suppose the logic would be to set a rotation from a to b and define b as a random number”
Yep, that’s what you want to do. Here’s one way to do it:
seedRandom(index,true);
r = random(-25,25);
if (numKeys == 2)
linear(time-key(1).time,0,key(2).time,key(1).value,r);
else
value;
you hadn’t mentioned timing, so i set it up to use to keyframes to allow you to define the timing with keys (which is typically how i’d do it anyway).
so the expression looks for keyframes, you need two to define the start point and the end point. the expression will use the value of the first keyframe as the start value, so set that to zero, the value of the second keyframe does not matter, since it will be replaced by the random value, it only uses it’s placement for timing.
the linear() function just interpolates the time between the two keyframes to the rotation values. if you wanted to ease between the keyframes, you can change linear() to ease() — note changing the keyframe interpolation will not effect the animation, since the interpolation of the expression will override that of the keyframes.
Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW