micku7zu / vanilla-tilt.js

A smooth 3D tilt javascript library.
https://micku7zu.github.io/vanilla-tilt.js/index.html
MIT License
3.85k stars 172 forks source link

Provide scroll as alternative to gyro #64

Open andreasvirkus opened 4 years ago

andreasvirkus commented 4 years ago

Because browser vendors now expose the device's orientation only when the user has granted permission (and I'm not sure but I think - like with other APIs - you can only ask permissions based on a user-initiated action, like a click listener?) then could we maybe have the option to tilt based on a scroll position?

I'd imagine this to be useful for marketing/landing pages, where you'd want a tilt effect on mobile devices, but can't presume a user to click anything before (so we'd have access to the rotation events) 🤔

Related: https://github.com/w3c/deviceorientation/issues/57

micku7zu commented 4 years ago

I've just refresh this on my Android in Chrome and it worked ok. I didn't have time to document on the subject lately.