Using react-spring
and react-use-gesture
I want to have a carousel animation that can be activated by dragging OR clicking on a button.
I've figured out a solution: https://codesandbox.io/s/viewpager-6o78r?file=/src/index.js
Putting a setTimeout
in a loop for frames of the animation, but I feel like there must be a better way. The way I'm doing it probably isn't as smooth because I don't have easing etc. Is there a way to use the from
and to
properties on the springs I've already created for use by the drag gestures?