chrisbateman / impetus

Agnostic utility for adding momentum to anything. It's like iScroll, except not for scrolling. Supports mouse and touch events.

Home Page:chrisbateman.github.io/impetus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bounds rubber-banding

abusedmedia opened this issue · comments

Hi there
Thanks for this very useful library.
I'm wondering if it would be possible to add a kind of negative inertia when bounds are defined thus the x/y props would be smoothly slowed down and bounced back to the bound value instead stopped immediately.

Definitely wouldn't mind adding this - I'll try to get around to it...

I'd like this as well ;) so just a +1

I added this in a separate branch - https://github.com/chrisbateman/impetus/tree/bounce

Please try it out if you can and let me know how it goes. Probably still needs some tweaking.

Very nice Chris!
Just tested briefly and it looks very good.
I would only add a cumulative friction during drag in order to slow down until stop after a while...
You can check my quick&dirty implementation about what I mean, here:
https://github.com/abusedmedia/impetus/blob/bounce/impetus.js#L208-L211

Thank you!

@abusedmedia Added that in the bounce branch. Still might want to tweak some of the overall physics a bit...

Anybody have a preference on whether this should be enabled by default? My thought is yes...

Implemented as of v0.8.0