This effect allows you to transform the geometry of your regular, rectangular SwiftUI View
s into quadrilateral segments ⏢, so you can do fun things like:
The shader uses bilinear interpolation to map pixel positions to the output via View.distortionEffect
. The repository features an editor app that allows you to give it a try in an interactive way.
Use as a Swift Package.
Use a View.segmentationEffect
modifier.
I made it mostly for myself as an exercise in my recent SwiftUI
+ Metal
research. At this point APIs have not been crafted very carefully, so the possibilities of the package are quite limited, but give it a try, and be sure to let me know if you like it. I can definitely spend some more time on it, if it is of use for anybody in a real project. At this point - it simply "works for me™️" ⏸️😁
Feel free to use it, feel free to contribute (fix issues, share ideas), and feel free to hit me up @czajnikowski 👋