Re: Need functionality of CAShapeLayer in 10.5
On Sep 21, 2010, at 6:14 PM, Kenneth Baxter wrote: > Just a quick question about this - I notice that you say to use a timer which > I presume you say deliberately rather than using the automatic needsDisplay > and recalculating during display. The automatic -needsDisplayOnBoundsChange will cause you to draw only once, at the new bounds value, not for every frame in-between. If that is acceptable, then that should work too. If you would have just changed the frame/bounds to implement the animation, that is fine as well. Either way, the implementation should be relatively straightforward. -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Need functionality of CAShapeLayer in 10.5
Just a quick question about this - I notice that you say to use a timer which I presume you say deliberately rather than using the automatic needsDisplay and recalculating during display. The way I was thinking of doing it would have resulted in the recalculation of the path during the drawing, which in turn would have meant that I would want to change the frame/bounds during the drawing, which presumably would not be a good thing, right? Is this why you would say to use a timer? So presumably that means I would get the timer to fire frequently and then ask the presentation layer for the values for my animating points, and if they have changed, I recalculate my path, and update the frame if necessary, using a transaction which disables animation, and then calls setNeedsDisplay. Sorry to need to bother you for the clarification, but I just need to make sure I understand correctly. On 22 Sep, 2010,at 10:32 AM, David Duncan wrote: On Sep 21, 2010, at 5:02 PM, Kenneth Baxter wrote: Any suggestions would be most welcome. With a requirement of 10.5, about all you can do is call -setNeedsDisplay from a timer to implement the animation yourself, unless your path can be animated well enough by just stretching/squeezing the layer. Either way your talking about drawing your path into a plain CALayer. -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Need functionality of CAShapeLayer in 10.5
OK, thanks for that David - I'll take that route then. On 22 Sep, 2010,at 10:32 AM, David Duncan wrote: On Sep 21, 2010, at 5:02 PM, Kenneth Baxter wrote: Any suggestions would be most welcome. With a requirement of 10.5, about all you can do is call -setNeedsDisplay from a timer to implement the animation yourself, unless your path can be animated well enough by just stretching/squeezing the layer. Either way your talking about drawing your path into a plain CALayer. -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Need functionality of CAShapeLayer in 10.5
On Sep 21, 2010, at 5:02 PM, Kenneth Baxter wrote: > Any suggestions would be most welcome. With a requirement of 10.5, about all you can do is call -setNeedsDisplay from a timer to implement the animation yourself, unless your path can be animated well enough by just stretching/squeezing the layer. Either way your talking about drawing your path into a plain CALayer. -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Need functionality of CAShapeLayer in 10.5
Hi all, I had gone through my initial design for a project I am working on and one part of it really needs to use CAShapeLayer, but I just realized that it's only available in 10.6+, and I have to support 10.5. Essentially I have two layers that have a bezier path drawn between them. The two layers at each end of the path are moved during animations, and the bezier path needs to be adjusted to stay connected with the layers at each end Seems to me that this would be easily done by CAShapeLayer, if I could use it. I presume people were probably doing this type of thing before CAShapeLayer came along, so I'm wondering if there is some sample code for an equivalent of CAShapeLayer or at least something that will allow me to easily update the path during the animation. I was thinking of using a startPoint and endPoint for the path which are animated, and have setNeedsDisplayForKey set, and just recalculate the path in the drawing method Is this a good approach, or is there a better way, or some existing code that may help out with this? It would be nice to be able to do something that has an API match with CAShapeLayer, so that when I can ditch 10.5 support (hopefully soon), I could just move straight to CAShapeLayer without having to change anything else, but that would presumably mean animating an arbitrary number of points in the bezier path and handling all sorts of situations like one path having more points than the other etc. Any suggestions would be most welcome. Thanks Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com