简体   繁体   中英

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. 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 Help

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM