nandorojo / moti

🐼 The React Native (+ Web) animation library, powered by Reanimated 3.
https://moti.fyi
MIT License
3.9k stars 120 forks source link

Is there any way to sync translateX and translateY animations? #318

Closed ReactorCSA closed 8 months ago

ReactorCSA commented 8 months ago

Is there an existing issue for this?

Do you want this issue prioritized?

Current Behavior

Because of the bouncy spring animations values in sequences become desynchorized after a while

Expected Behavior

Animate together translateX and translateY and wait until last animation ends

Steps To Reproduce

image

You just have to write something like this inside moti view. After a while because of the different distance — component starts his movement not diagonally, first goes x then y axis.

Versions

- Moti: 0.27.0
- Reanimated: 3.3.0
- React Native: 0.72.6

Screenshots

No response

Reproduction

no build

nandorojo commented 8 months ago

Probably with a timing animation instead of spring

ReactorCSA commented 8 months ago

Thanks for the fast response sir! Sure you are right! But spring animations look so great! Maybe it can be handled like a transformMatrix or something like this? I ran into moti after react-spring, which seemed to handle this well But as far as I know its the react-reanimated issue with its way to animate translateX and translateY like a different elements. But anyways I think it will be really cool to handle it

nandorojo commented 8 months ago

What if you add a duration to the spring animation? It’s indeed a reanimated issue

ReactorCSA commented 8 months ago

WOOOOOOWWWWW it looks like a solution 💯 thanksssssss siiir!!!!