Animate line drawing (Quartz 2D?)

How do you plan to animate line drawing in UIView on iPhone? Is it possible? It can be drawn, but can it easily be animated to look by hand?

0


a source to share


2 answers


With the new API, you can do this easily using the strokeEnd

CGPath property .



You can read more here: What's the easiest way to animate a string?

0


a source


There is no built-in way to do this. You will have to redraw the line again, interpolating between the start and end points, using a timer callback to invalidate the view and cause the redraw. Of course, a redraw would have to paint everything in the view area in order to redraw, which is potentially slow.



What I would do if I had a series of lines that I would like to draw over a period of time is to have two subheadings - they will cover the same area, and the top will have a transparent background. Make the top draw just the line that I am animating now, and when it ends draw its full length in the bottom view. Then re-animate the next line in the top view.

+2


a source







All Articles