I am learning Swift with the cs193p online class https://cs193p.sites.stanford.edu/.
One of the assignment entails creating a custom shape (like a diamond) and then applying a striped pattern to its background (with different colors).
I was wondering whats a good way to approach this (without using images if possible). Looked around quite a bit but don't even know where to start. In general, is there any way
Googled around a bit but couldn't find any good solutions.
Here is one way to do it. Create a
ShapecalledStripes:Then when you are drawing a striped shape:
where
scaleis aCGFloatthat you'll want to vary depending on the size of the shape that you are drawing. Start with a value of1.0and make it larger to get the right look.shapeis one ofRectangle(),Capsule(), orDiamond().