Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: