I'm trying to draw a prism and animate it with CoreAnimation. But I can't find a good solution to draw the fan of rainbow colors.
There a a couple of ways to do that, each of them has disadvantages:
- I could simply use an image. But I allow the user to zoom into the scene and I'd like to avoid any artefacts.
- Using a
CAGradientLayer
produces a nice rainbow. Unfortunately there is now skew (or squeeze) transformation available to transform the rectangular rainbow into a triangle. - A simple skew effect of the layer can be obtained by modifying the m34 matrix element of the layer's transform matrix. But I wasn't able to obtain a triangle shape (because the layer would have to be of infinite size).
- OpenGL. That'll work, but maybe there's a simpler way.
Any suggestions?