Awesome -- I'll give it a go. That makes total sense. Thanks so much! On Thu, Jun 4, 2009 at 9:04 PM, Graham Cox <graham....@bigpond.com> wrote:
> > On 05/06/2009, at 1:48 PM, Miles wrote: > > Thanks for the quick response! >> >> I've mostly been reading trying to see what would work. I did mess with >> changing the anchorPoint to get the initial animation route, but that didn't >> seem to suffice. >> >> The object I'm animating is a simple UIView containing an image. >> >> I thought about the timer approach like you mention, the reason I shy'd >> away from it was that it needs to stay in sync with another animating object >> (in my ferris wheel example this would be the wheel itself.) >> But now that I think of it I might be able to use the timer to animate >> that as well so they do stay in sync. >> >> Does that seem like the best and/or easiest approach? >> > > > > Well, I'd say it can be made to work, but I personally wouldn't do it this > way. > > It's still a bit vague, but I'm visualising a Ferris Wheel with a number of > (one or more) attached basket objects. To model this, I would define the > angle and radius as properties of the wheel, and the position of the basket > as a property in terms of its position relative to the wheel (a fixed angle, > say). The basket objects could be owned by the wheel, which makes good sense > to me. > > To animate the rotation of the wheel, simply increment the angle of the > wheel. This in turn directly or indirectly updates the positions of its > attached baskets. The whole thing is then redrawn in the new position. The > absolute location of a basket can be simply calculated as needed when the > basket is drawn, based on the wheel's angle, radius and relative position of > the basket on the wheel. > > Any time I hear people talking about "keeping things in sync" alarm bells > ring. Instead, make one property a derivative or dependency of the other, > then there is nothing to 'sync', it's always in sync. > > In terms of visualising the wheel/basket model in a view, I'd just use a > custom view and drawn the entire content. The wheel object could draw > itself, which in turn calls on each of its basket objects to draw > themselves, and so on. Trying to make each basket a separate view will be > inefficient and more complicated than this. > > --Graham > > > _______________________________________________ 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