title: How to use JavaScript create a damping function?
body: <p>I'm writing a scrollbar plugin. When dragging, I want to simulate the function of Safari(IOS), that is, overflow is allowed after dragging to the edge. In fact, Safari (IOS) has an edge decreasing effect when dragging, that is, it will become more and more immobile. This effect seems to be realized by <strong>damping function</strong> ? I tried to search, but I didn't find a particularly suitable function. I found some relevant contents in this article : <a href="https://medium.com/@esskeetit/how-uiscrollview-works-e418adc47060#9c17" rel="nofollow noreferrer">How UIScrollView works</a>, but I don't understand OC and Swift, and I'm not very good at math. Can anyone help me. ಥ_ಥ</p>
  <p>Here is the damping function provided by another article : <a href="https://github.com/JunreyCen/blog/issues/8" rel="nofollow noreferrer">drag damping</a>, but in fact, it uses a piecewise function to achieve the damping effect. Although it will be faster, it is found after the test that it does not meet my needs. I hope to set the maximum target value clearly, but in this function, it cannot explicitly control the maximum value.</p>
  <p>This is a screenshot of the project. At present, the dragged part has not been completed, but the wheel control part has been realized, and the overflow can also be realized. However, because there is no appropriate damping function, the increment after overflow seems very rigid.</p>
  <p><a href="https://i.stack.imgur.com/Qoesk.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qoesk.gif" alt="enter image description here" /></a></p>