How to animate the drawing of a CGPath?

后端 未结 2 1821
离开以前
离开以前 2021-02-05 23:58

I am wondering if there is a way to do this using Core Animation. Specifically, I am adding a sub-layer to a layer-backed custom NSView and setting its delegate to another custo

2条回答
  •  爱一瞬间的悲伤
    2021-02-06 00:32

    Sure—don't draw the line yourself. Add a 12-pixel-high sublayer with a flat background color, starting with a zero-width frame and animating out to your view's width. If you need the ends to be rounded, set the layer's cornerRadius to half its height.

提交回复
热议问题