Prism Drawing with CoreAnimation

I am trying to attract a prism and animate it with CoreAnimation. But I can’t find a good solution to draw a fan of rainbow colors.

prism

There are several ways to do this, each of them has disadvantages:

  • I could just use an image. But I let the user zoom in on the scene, and I would like to avoid any artifacts.
  • Use CAGradientLayercreates a pleasant rainbow. Unfortunately, there is currently skew (or compression) to transform a rectangular rainbow into a triangle.
  • A simple oblique layer effect can be obtained by modifying the matrix transform matrix element m34. But I could not get the shape of a triangle (because the layer should have an infinite size).
  • OpenGL. , , , .

?

+3
1

, transform CALayer. AGGeometryKit CATransform3D .

0

Source: https://habr.com/ru/post/1752995/


All Articles