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.
我想逐渐绘制一条路径,即我希望路径看起来好像是用手绘制的。我设法创造了我需要的道路。我还设法创建了一个使用此路径的CAKeyFrameAnimation。但到目前为止,我只能沿着这条路径移动一个物体。我想沿着路径移动一个物体(比如一支铅笔),并让路径看起来好像被画出来一样。
Any pointers?
1 个解决方案
#1
9
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.)
使用您的路径创建CAShapeLayer,并将图层的strokeEnd设置为0.0到1.0。 (这是iOS SDK 4.2中的新功能,不适用于以前的版本。)
#1
9
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.)
使用您的路径创建CAShapeLayer,并将图层的strokeEnd设置为0.0到1.0。 (这是iOS SDK 4.2中的新功能,不适用于以前的版本。)