Smooooth motion, the StevenRoy way
Here's the way I do it:
Suppose I had a variable "dx", which I want to set to a random value between -1 and 1 on each beat. The simplest way to do that, of course, is to put this in the Beat code:
dx=(rand(201)-100)*.01
Now that's all well and good, but it does have that jerkiness problem. My favourite way to smooth out the motion is quite similar to what ^..^ described:
Frame:
dx=dx*.9 + tdx*.1
Beat:
tdx=(rand(201)-100)*.01
This causes dx to slide towards tdx (I use the extra t to mean "target"), at a rate proportional to their difference. In other words, it starts out quickly and slows down as it nears its target. To adjust the speed of this transition, you can change the .9 and .1 coefficients to other values, such as .95 and .05, or even .99 and .01 to make it nice and slow. (These coefficient pairs should add up to 1; it's not necessary, but it makes it easier to know what you're getting.)
In most cases, this is pretty good... but every time tdx changes, dx starts homing towards it, and it's a sudden, jerky start. Surprisingly, the way to fix this start is simply to repeat the process; add another target variable and make that the target of our first target variable.
It ends up looking something like this:
Frame:
dx=dx*.9 + tdx*.1;
tdx=tdx*.95 + ttdx*.05;
Beat:
ttdx=(rand(201)-100)*.01
Voila. Smooth motion. (Notice that I gave the tdx->ttdx motion different values to slow it down a little.)
Now, if you're
really anal about code optimization, you may notice that ttdx is being multiplied my the same value once per frame, even though it doesn't change. This multiplication can be moved to the onbeat code for a very, very slight performance boost. (Most of the time, I don't bother.) The same goes for the tdx multiplication, for a similar reason. You can end up with code that looks like this:
Frame:
dx=dx*.9 + tdx;
tdx=tdx*.95 + ttdx;
Beat:
ttdx=(rand(201)-100)*.00005
It's not uncommon for me to use code like this several times in a single Dynamic Movement.
Of course, it usually takes more than smooth motion to make a good AVS preset, but it usually helps.