Skip to content

Instantly share code, notes, and snippets.

@idettman
Last active October 29, 2025 04:51
Show Gist options
  • Select an option

  • Save idettman/bc793561247c8435f6fbe46bcc8a98b8 to your computer and use it in GitHub Desktop.

Select an option

Save idettman/bc793561247c8435f6fbe46bcc8a98b8 to your computer and use it in GitHub Desktop.
Smooth mouse
/*
distance you are computing is NOT used. (in fact only to see if we get less than a distance of 1, which can be done much easier/faster).
The value (v) that we want to become target value (tv) Choose k, the proportion ( within [ 0 ; 1.0 ] ) of the actual value you want to keep, the rest you will update.
For example if you choose keep 90% and you change 10% for each movement, then in 10 frames you reached goal.
v = k * v + (1 - k ) * tv;
expl : v = 0.9 * v + 0.1 * tv;
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment