开发者

Drawing a path with CAKeyFrameAnimation on iPhone

开发者 https://www.devze.com 2023-01-29 07:14 出处:网络
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

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 p开发者_开发百科ath, and have the path appear as if it is drawn.

Any pointers?


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.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号