Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Design Looking for tips on normalising a custom inertia scroll

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #264551
    Shikkediel
    Participant

    Merry Xmas, y’áll. I’m coding a bit. Lol. Actually, I’ve been searching the web for how iOS has constructed their inertia scrolling in such a way that the page speed is equal to that given by the user when the screen is released.

    I’ve made a demo where the mouse and touch moves are tracked. Practically, I thought only the last ten events were relevant. I then simply take the difference in time and distance between the last and first and calculate speed from that (red line). But there must be some smoother way…

    Here’s the pen, the movement is plotted in the graph:

    https://codepen.io/Shikkediel/pen/ZvpGzJ

    Dots are the events, time scale is horizontal and distance vertical.

    Generally, it seems to be pretty close although there are some occasions where the time gap between the first and second instances is thus big that the final speed comes out too low. The machine must be busy doing other things initially. It otherwise runs the animations beautifully at a near consistent 60fps by the way as there are no DOM manipulations requiring repaints. Quite pleased with that.

    Any suggestions on a broad approach (perhaps a link to an example or a practical mathematical method) to this are very welcome. Or maybe someone has an insight in to how the scroll plugins handle it. Googling turns up mostly unrelated stuff.

Viewing 1 post (of 1 total)
  • The forum ‘Design’ is closed to new topics and replies.