Closed artidataio closed 3 years ago
Try to reverser the start and end.
Feels weird to me to reverse the end and start. But I got it.
const handleClick = () => {
setPlay(!play);
if (play) {
setStart(end + 200);
} else {
setEnd(start + 200);
}
};
full code here: https://codesandbox.io/s/use-hooks-to-control-animate-forked-1yhhw?file=/src/index.js
As seen in the Use Hooks to control Animate section of https://react-simple-animate.vercel.app/advanced, a boolean state will always reverse the animation when the state changes. Instead of reversing, I would like that the next button click will reuse the initial animation. Such that, Instead of going back to 0px, the square will go to the 400px. Can we do that with this package?