开发者

Right tool for the job: CoreAnimation, Cocoa Animation, or OpenGL ES?

开发者 https://www.devze.com 2023-01-10 07:20 出处:网络
I am relatively new to doing graphics work on the iPhone and was hoping to get some guidance on which technology I should employ.The issue I am facing is that I need to create an iPhone app that will

I am relatively new to doing graphics work on the iPhone and was hoping to get some guidance on which technology I should employ. The issue I am facing is that I need to create an iPhone app that will have a spinning wheel in it, think the Price Is Right wheel.

I am not looking for anyone to provide a detailed solution, that would sp开发者_高级运维oil my fun! I would simply like to know would it be better to use straight Cocoa Animation and draw and move each cell by hand as the wheel spins, or should I attempt to use Core Animation Layers? I have also thought of using OpenGL ES and building a true cylinder in 3D and then rotating that, this seems the most logical to me but again I am new to all of this.


For situations like this, I usually recommend looking first to Core Animation and only going to OpenGL ES if you can't get the kind of performance you need. Redrawing a wheel frame-by-frame using only Quartz will result in abysmal performance, so that's not really an option here.

Using Core Animation, you can perform complex animations, such as your rotation, without requiring much code. You also can leverage UIViews and other UIKit components to provide touch interaction easily. You don't even necessarily need to step down to using layers, as every UIView is layer-backed and they tend to be pretty lightweight.

OpenGL ES will give you the best possible performance, but I wouldn't think you'd run into a limitation when simply spinning a wheel using Core Animation, even on older devices. OpenGL ES will require a lot more code to achieve the same effect, and will be more difficult to integrate with any touch interaction you may wish to do.


Based on the feedback I have dug deeper into Core Animation and have been able to accomplish what I need using it. Thanks for all the advice.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号