jhd
jhd

Reputation: 1253

How to animate a CAShapeLayer`s path to another path smoothly?

I have a CAShapeLayer with a specifical shape. And i want to change the path of the layer to animate its shape. But when i use CABasicAnimation, the animation is always not that good to match my requirement.

I try some different ways. I have the same number of points in two paths. The points of the previous path does not go the place i want. Some straight lines occurs. I want to animate a cloud into a circle. Here is the images show the problem. enter image description here enter image description hereenter image description here Help

Upvotes: 0

Views: 254

Answers (1)

clemens
clemens

Reputation: 17711

You should give CAKeyframeAnimation with intermediate shapes a try. I think the spike in the cloud is reason for the unexpected behaviour. The intermediate shapes should transform the cloud to a convex and smooth shape (like a potato), and after that to a circle. I would try to move only the spike and its surrounding points first.

Upvotes: 1

Related Questions