Drawing a path with CAKeyFrameAnimation on iPhone

谁说我不能喝 提交于 2019-12-04 20:21:40

问题


I want to draw a path gradually, i.e. I want the path to appear as if it is drawn by hand. I have managed to create the path I need. I have also managed to create a CAKeyFrameAnimation that uses this path. But so far I can only move an object along this path. I would like to both move an object (say a pencil) along the path, and have the path appear as if it is drawn.

Any pointers?


回答1:


Create a CAShapeLayer with your path and animate the layer's strokeEnd from 0.0 to 1.0. (This is new in iOS SDK 4.2, won't work with previous versions.)



来源:https://stackoverflow.com/questions/4390911/drawing-a-path-with-cakeyframeanimation-on-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!