Animating a shape with CoreAnimation

前端 未结 2 1310
醉酒成梦
醉酒成梦 2020-12-28 18:42

I approaching core animation and drawing empirically. I am trying to animate a simple shape; the shape in question is formed by 3 lines plus a bezier curve. A red line is al

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-28 19:08

    You won't be able to animate your shape with CA. You can only animate layer properties in CA, not custom properties.

    CA can be fast because it doesn't have to call back to your code to perform animations, if you think about how it is implemented, it basically is just a thread running GL primitives operations with CALayer frames and contents.

    CA animations are sets of instructions for CA to run on its background thread, fire and forget (plus callback at animation completion), not callbacks to your code.

    Animating the contents of a layer would require CA to call you back to draw at each frame, or to let you instruct CA about how to draw. Neither of those happen.

提交回复
热议问题