Re: CoreAnimation with and manual animation...
Re: CoreAnimation with and manual animation...
- Subject: Re: CoreAnimation with and manual animation...
- From: Jens Alfke <email@hidden>
- Date: Tue, 1 Apr 2008 15:17:41 -0700
On 1 Apr '08, at 10:44 AM, Jesse Grosjean wrote:
n my app it seems like it would be simpler to just setup a timer and
just directly update the ships position based on it's velocity for
each time interval from my timer. I'd still want to use the built in
core animation animations for other properties such as transparency,
filters, etc. But for layer position it seems like it would be
easiest to control that directly...
You're right. Last year I was fooling around with hooking CA up to a
2D physics engine, and I just let the engine tell me where and when to
position the objects, and set their position properties accordingly.
For best results, disable animations for this, otherwise CA will try
to interpolate positions and things won't move correctly. I was doing
this by using a CATransaction to disable all animations, but I think
in hindsight it might be better just to to adjust the layers'
animation dictionaries to clear out the animation for the "position"
key.
(Using an existing physics engine is a great way to go, if you want to
do this. I was using Box2D, but there's another similar one called
Chipmunk. The math for this stuff gets really hairy — I've just
started reading "Physics For Game Developers", and it's fascinating
but I'm so glad I don't have to implement that myself!)
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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