如何用动画画线? [英] how to draw line with animation?
问题描述
我已经实现了游戏应用程序,其中我想在两个对象之间绘制线。我在两个对象之间画线。但我想用动画绘制。你建议我在两点之间使用哪个动画。
I have implemented game application in which i want to draw line between two object.I have drawn line between two objects.But i want to draw with animation.can u advise me which animation i have to used between two points.
编辑:我的问题是:
假设有两个点,如起点(100,100)和终点(300,300)。我可以在这两个点之间画线但是我想画动画线。我的意思是我可以看到从开始点到终点的行开始有2个secon持续时间。请帮我解决这个问题。
My excatly question is that: Suppose there is two point like start point(100,100) and endpoint(300,300).I can draw line between this two point but i want to draw line with animation.I mean i can see line start from start point to end point with 2 secon duration.please help me about this question.
推荐答案
给布拉德的答案+1 - 它会起作用 - 但看起来你可以更直接地完成同样的事情通过在CAPathLayer上设置strokeStart和strokeEnd属性的动画来制作时尚。
+1 for Brad's answer—it'll work—but it looks like you can accomplish the same thing in a more straightforward fashion by animating the strokeStart and strokeEnd properties on CAPathLayer.
参见 http://oleb.net/blog/2010/12/animating-drawing-of-cgpath-with-cashapelayer/
这篇关于如何用动画画线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!