jwagner / simplex-noise.js

A fast simplex noise implementation in Javascript / Typescript.
MIT License
1.61k stars 130 forks source link

Make the library compatible with `react-native-reanimated` #68

Closed xseignard closed 6 months ago

xseignard commented 6 months ago

Why

Supersede #67

react-native-reanimated is a popular library for react-native to create and drive animations.

See https://docs.swmansion.com/react-native-reanimated/

react-native is running on 2 threads:

To be able to run simplex-noise on the UI thread with react-native-reanimated we need to workletize the functions.

You can read more here: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#worklet

How

Test

Tested on mobile with react-native@0.72.6 and react-native-reanimated@3.6.2

Impacts

Good to know

Will only work with react-native-reanimated@3.6.2+

jwagner commented 6 months ago

Hey @xseignard , did you get any response from @software-mansion on alternative ways to solve this?

While this PR does not change the code anymore it still adds a lot of dependencies and complexity at build time which will require maintenance. It just doesn't seem right that every library would need to add something like this just to be called.

xseignard commented 6 months ago

I agree it is kind of over-engineered 😅 I'll try to get some attention on the subject to see if there's a better way.

jwagner commented 6 months ago

Hey @xseignard , I wonder how I should continue with this. If I understood the discussion correctly https://github.com/software-mansion/react-native-reanimated/pull/5669 should resolve this issue. Should we just wait for that to land?

xseignard commented 6 months ago

Hello 👋 Yes at one point it will solve the current issue.

So I think this PR can be closed.

Thanks for the follow up! 🙏