In code, we compare the distance to the velocity, and set the velocity to zero.
The only wrinkle is that we're dealing with both positive and negative values, and what we mean by "less than" is actually "nearer to zero". So we take the absolute (always positive) value of each before we do the comparison:
Jitters fixed !
|