This is a process in the DSP domain. You've implemented a single-order IIR filter; the recurrent equation is:
output += (input - output) / 100
Or written out fully,
output = output * 1 + output * -0.01 + input * 0.01
In general, we can construct the new sample output from some past history of output[n] and input[n], where we multiply each element of each array by some gain coefficient determined by the type of filter we want.
The general form, implemented in code, would look something like:
out = 0;
for (var i = 0; i < 999; i++) {
// shift histories
input[i] = input[i+1];
output[i] = output[i+1];
out += output[i] * feedback_gain[i] + input[i] * input_gain[i];
}
output[999] = out;
The name for this is a convolution. That is, the new output is the previous outputs convolved with feedback_gain, plus the previous inputs convolved with input_gain.
Your case we can write in this canonical form as,
output[n] = output[n-1] * 0.99 + input[n] * 0.01
being that the gain terms are fixed constants, and the array lengths are very short, in fact just 1 (no arrays needed at all), since we get "output[n-1]" for free in this procedural programming language.
An output which depends only upon its inputs (or only the last output, in certain ways), is called an FIR (finite impulse response) filter. An output which depends on previous inputs and outputs, is called an IIR (infinite impulse response) filter.
Your example here, does eventually stop, due to rounding error in the double-precision numbers that JavaScript uses (or at least which my browser apparently uses), but if infinite precision variables were available, it would continue along that exponential curve indefinitely. Hence, it is an IIR type.
Note that, if we only need the previous state or two, we don't need to store all 1000 or whatever previous states, we only need a couple variables. Any terms that have a gain of zero, we can simply cut out. So it's not important that your example doesn't use 1000-long arrays for inputs and outputs, because all you needed was the prior state of each.
So we can use this fully general framework, and strip it down to just what's needed, no worries.
So, acceleration. You have a linear DSP system -- that is, the output is always proportional to the input. The acceleration, then, is also proportional. If you wanted a fixed acceleration limit, then you need a nonlinear DSP system.
You might instead write:
diff = input - output;
diff = Math.max(diff, -MAX_ACCEL);
diff = Math.min(diff, MAX_ACCEL);
output += diff / 100
Note that the max of two negative numbers, equals the one closer to zero; and the min of two positive numbers, does as well. So these expressions serve to limit the difference, and thus the acceleration.
Note you can still have it resolve to a nice linear function (the exponential curve) within the acceleration limit. Or you can crank up the gain so that the output more closely follows the input.
This is also known as a slew rate limit. The change of voltage on a capacitor, requires a current flow, and limiting that current within a certain range acts to limit the voltage slew rate.
This further suggests opportunities, if you can tell us more about your system. For example, if you have a DC motor connected to a linkage with significant mass, it can be driven with a limited current, which limits the torque available from the motor, and thus its acceleration. This has the double bonus of limiting current from the driver, protecting it from destruction even if the motor stalls.
Tim