Hacker News new | ask | show | jobs
by Doxin 28 days ago
A linear ramp would work, but you can probably get to the end-point quicker if you're not going linearly. Something like

needle_position = needle_position * 0.9 + desired_needle_position * 0.1

is very easy to implement, easier than linear if you ask me, and should give it a nice damped movement. The constants can be tuned to go as quick or as slow as you like of course.