Can a website keep track of speed of scrolling or the position of the page?

I’d like to make events happen when someone navigates my website at a certain rate. Some examples I can think of are

if, on mobile, the user flings the screen up, causing the website to scroll down rapidly, it causes an event to happen (probably a timeline)

if on either mobile or desktop, the user scrolls up and down rapidly, a different event happens

I’ve been using Velo to do some basic timelines and things of that nature. I don’t know if there is some value I can call upon that represents the current position of the page, or if you can measure scroll speed/direction (but not control speed/direction) and create your own variable that is that value

That’s a pretty interesting use case !

I don’t know of any built in way to do this, but I did create quick reusable component that allows you to track the scroll location, all on the frontend, and then allows you to adapt to it. Built it because I wanted it myself. There’s a short explainer video too - https://www.threedsoftware.com/post/lix-components-scroll-manager

You can track how far a user has scrolled using getBoundingRect, or a Custom Element