react-native-skia icon indicating copy to clipboard operation
react-native-skia copied to clipboard

Add Atlas example using multiple unique sprites

Open dcarubia opened this issue 1 year ago • 2 comments

This PR adds an example to the Atlas docs showing an Atlas texture being used to render multiple unique sprites to form a pattern

dcarubia avatar Mar 14 '24 00:03 dcarubia

Thanks a lot Danny, you're catching something really interesting here :) To implement this example, we would use the color property actually with a single sprite (a path).

Also we would need to add the example here: https://github.com/Shopify/react-native-skia/blob/main/package/src/renderer/tests/e2e/Atlas.spec.tsx#L278 (you can read more about writing these tests at https://github.com/shopify/react-native-skia?tab=readme-ov-file#contributing) But if this is too much I could do it too.

wcandillon avatar Mar 14 '24 11:03 wcandillon

Thanks @wcandillon , that makes sense. I'll update this example to use the color prop with a single sprite. Re: adding tests - happy to do that as well but likely won't get to that until next week so feel free to get this across the line sooner if that works better for you!

I still think a demo showing how to use multiple sprites in an atlas would be valuable so if you agree I can work on another example that does a better job of showing that use case. Potentially something similar but with a few unique shapes, or an example with images could be interesting (could we show a strategy for loading the images to use in the texture?). Lmk if you have thoughts :)

dcarubia avatar Mar 14 '24 19:03 dcarubia

looks like we can close this for now

wcandillon avatar Jun 28 '24 07:06 wcandillon