darsain / sly

JavaScript library for one-directional scrolling with item based navigation support.
http://darsa.in/sly
2.87k stars 497 forks source link

Disabling easing animation and including scroll velocity? #29

Open KingScooty opened 11 years ago

KingScooty commented 11 years ago

There's a situation where i want horizontal scrolling to behave native (similar to overflow-x: scroll), instead of snapping to slidee items.

However, the scrolling looks a bit strange, i think it's a combination of both the easing animation and the lack of scroll velocity.

This plugin appears to calculate velocity quite nicely. Is there any chance of incorporating it into Sly?

http://brandonaaron.net/code/mousewheel/demos

darsain commented 11 years ago

I don't understand what is the problem. If the horizontal scrolling with disabled item based navigation doesn't work for you, you should read the "Horizontal non-item based navigation!" section in Markup documentation.

KingScooty commented 11 years ago

Oh it's working a treat! I'd already forced a width of the slidee container.

I was just curious about overriding the scroll speed. At the moment it's a fixed value scrollBy: x. What would be nice (for none item scrolling) is disabling the easing and having the scrollBy value vary depending on scrollVelocity like in that mouse wheel plugin

darsain commented 11 years ago

You can disable easing. Just set it to linear. If yo uare talking about a length of an animation, that's what speed is for.

And I still don't understand what is this scroll velocity. The square on the page you are linking displays always "Up/Down at a velocity of 1".

When I turn my middle mouse button, I get 1 scroll event, which has either positive or negative delta. Than Sly animates content by scrollBy value either forward, or backwards depending on that delta. Where is any velocity in here, and where is it coming from?

KingScooty commented 11 years ago

Ohh, it must be a Mac thing then. The square on that page shows the scroll value increase and slow down depending how fast i scroll, which makes for nice, non-linear scrolling without the need for easing.