1000ship / react-scroll-motion

🎞 Easy to make scroll animation
https://1000ship.github.io/react-scroll-motion
MIT License
422 stars 47 forks source link

Feature request: Callbacks for the animations? #21

Open leeprobert opened 2 years ago

leeprobert commented 2 years ago

More of a feature request but is it possible to include a callback for the animations? Is this possible now somehow? I would love to know when the element has begun to move or has ended. I would also love to get more information about the scroll position for the different pages. What the position should be when a page starts to move etc.

1000ship commented 2 years ago

It's not possible yet. But I can make that hooks. What kind of hooks do you need?

ex) onPageAppear, onPageDisappear... so on

leeprobert commented 2 years ago

I don't suppose you did this, did you? I have a requirement to animate an image sequence on scroll so I need a way to pass in a prop to a component that represents the scroll position of the <Animator> as it is scrolled. Then I can calculate the frame number.

I would add some hooks for the page scrolls as you mentioned but also have one that gives you a normalised value of the scroll between 0 and 1 as well as the actual pixel value for the scroll.