How to animate a human written stroke using Swift/iOS?

后端 未结 3 2018
忘了有多久
忘了有多久 2021-01-30 02:24

Objective

I am attempting to create an animated approximation of human writing, using a UIBezierPath generated from a glyph. I understand and I have rea

3条回答
  •  忘掉有多难
    2021-01-30 02:58

    You want to look at CGPathApply (this is the short answer to your more refined question). You supply it with a function and it will call that function for each element (these will be lines and arc and closes) of the path. You can use that to reconstruct each closed item, and stash them into a list. Then you can figure out which direction each item is drawn in (I think this could actually be the hardest part) and rather then using strokeStart/strokeEnd one each subpath draw it in a layer with a mask and move the mask across the layer.

提交回复
热议问题