Hacker News new | ask | show | jobs
by dhgamache 4414 days ago
Hi there. I developed the demo and this is basically exactly what I do...the only difference is apply a multiplier to slow it down. I mentioned in the Medium post about this I am traveling and unfortunately didn't have access to anything but my MacBook Pro and my girlfriend's Air.

That said, seems like a common criticism is scroll speed is too slow, so by changing a couple small params, I halved all the scroll speeds.

I might totally be missing something, but seems like the concern is just relationship of scroll to movement of objects which I define in a big object. That said, I am no JS whiz and might be doing it all wrong.

1 comments

Running your scroll within requestAnimationFrame isn't what makes the scrolling smooth, its the scroll multiplier which does it, making sure that deltas (or changes) in the y-position are normalized down into what will eventually be a zero, but over time. By constantly updating the future scroll position by running in through the equation and then applying it to your container whenever the user scrolls, you'll achieve a nice ease, which can then be dispatched to each of your parallax layers.

Here, I've just pushed an example to Github and Firebase. Feel free to check it out and let me know if you have any questions:

https://smoothscroll.firebaseapp.com/

https://github.com/damassi/smooth-scroll-example