How do you animate an SVG path in IOS?

后端 未结 3 2342
灰色年华
灰色年华 2020-12-08 08:35

I have an SVG path like this:



        
3条回答
  •  [愿得一人]
    2020-12-08 09:25

    Try animating the 'stroke-dashoffset' (note that you need a matching 'stroke-dasharray' with it), see this example. The length of the path that needs to be computed to be able to use this successfully can be fetched via script like:

    var pathlength = yourPathElm.getTotalLength()
    

    View source on the example to see how it's done.

提交回复
热议问题