• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Animate a CGPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Animate a CGPath (From: "Daniel Weber" <email@hidden>)

  • Prev by Date: Leopard exception handling driving me crazy!
  • Next by Date: Programmatically dismiss NSPopUpButton menu
  • Previous by thread: Animate a CGPath
  • Next by thread: New Core Data document
  • Index(es):
    • Date
    • Thread