Re: Animate a CGPath
Re: Animate a CGPath
- Subject: Re: Animate a CGPath
- From: David Duncan <email@hidden>
- Date: Fri, 12 Sep 2008 11:12:18 -0700
On Sep 11, 2008, at 12:21 PM, Daniel Weber wrote:
Hi everyone. I have an NSView with some appkit drawing code that I'm
trying
to convert to core graphics drawing code. One thing I'm having
trouble with
is the transition from NSBezierPath to CGPath. Basically in my
application,
I want to animate the drawing a curve. In other words, I want to
show the
path being drawn over a relatively long period of time (about 2
seconds).
When I was using NSBezierPath, I would do this by first flattening
the path,
then using a timer to call the draw method to draw elements 0 to 1,
then 0
to 2, then 0 to 3, and so on until I reached the end of the curve. The
effect was that the user could see the curve being "animated". Is
there a
way to "flatten" a CGPath? Is there another way to do this in Core
Graphics?
It sounds like what you want is CGPathApply(). It will allow you to
break a path down into its components and do whatever you please.
That said, it is probably cleaner to simply draw the individual
components yourself rather than using a CGPathRef, as all of the path
operations have equivalent functionality that can be done directly on
the context.
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden