scrollmonitor-parallax icon indicating copy to clipboard operation
scrollmonitor-parallax copied to clipboard

RAF

Open samburgers opened this issue 8 years ago • 4 comments
trafficstars

heya, does (or should) this use requestAnimationFrame? the demo example is quite janky in chrome even. cheers!

samburgers avatar Aug 13 '17 11:08 samburgers

This does not us RAF as it's impossible to get two scroll events in a single frame. I did a lot of experimenting when I made the scrollmonitor to ensure that. It shouldn't use RAF because that would just delay the events and rendering by one frame.

I'm guessing your scroll wheel is the standard kind that scrolls in increments of 60px or so, so the parallax moves in the same increments. Instead of using the wheel try dragging the scroll bar to see if it's smoother. If you want to smooth everything out at the cost of responsiveness, you can put a transition of about 50ms on your elements.

stutrek avatar Aug 13 '17 15:08 stutrek

Chrome browser on a 1yr old macbook using fluid touchpad to scroll. Adding transition: all 50ms linear helps a little, but still quite stuttery especially on the rotating element on the demo. Wonder if scroll event throttling might help a little if RAF doesn't appear to be a solution?

samburgers avatar Aug 13 '17 23:08 samburgers

I don't know what's wrong, I suspect something with your video card. I've seen the demo running at 60fps on a phone. If anyone +1s this issue I'll take a deeper look, it may be that the way Chrome optimizes something has changed.

stutrek avatar Aug 14 '17 14:08 stutrek

works smoothly in OSx crhome

lazysergey avatar Nov 21 '18 05:11 lazysergey