iPhone/iPad SDK:通过一系列图像触摸旋转看似 3D 的物体
任何人都可以让我走上正确的道路,了解如何对对象进行动画处理,就像通过触摸+拖动来旋转它一样吗?我们以 10 度的间隔拍摄旋转托盘上物体的图像。
我正在修补 Titanium,并运行了一个演示,我只是将图像更改为数组中的下一个(或上一个)图像,具体取决于我捕获 swipeLeft 或 swipeRight 的方式。它并不漂亮,但它在模拟器中有效。当我把它放到 iPad 上时,它运行缓慢并且崩溃了。
我已经切换到 Xcode,并且一直在学习 Cocoa/Cocoa Touch 的痛苦中。我只是想知道当我捕获拖动事件时替换 UIImageView 中的图像是否走在正确的道路上,或者我是否应该制作两个与拖动方向相对应的动画,或者我是否应该查看完全不同的方法,例如 OpenGL,尽管这看起来不太正确。
非常感谢您的帮助!
Can anyone kindly put me on the right path as to how to go about animating an object as though it's being rotated by touch+drag? We took images of an object sitting on a rotating tray at 10-degree intervals.
I was tinkering with Titanium and had a demo running whereby I simply changed the image to the next (or previous) image in an array depending on which way I caught the swipeLeft or swipeRight. It's not beautiful, but it worked in the simulator. Once I put it on the iPad it ran slow and crashed.
I've switched to Xcode and I've been in the throes of learning Cocoa/Cocoa Touch. I'm just wondering if I'm on the right path by replacing the image in the UIImageView as I catch drag events or if I should make two animations that play corresponding to the direction of the drag, or if I should be looking at an entirely different approach, such as OpenGL, though that doesn't seem right.
Thank you very much for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
替换 UIImageView 上的图像应该足够了(这将是我的第一个想法)。您可能面临的问题归结为速度。加载图像后,相应的动画应该很快(假设您不会加载相同的图像两次)。
我不会为此编写 OpenGL 应用程序。这似乎有点矫枉过正。
不知道 ipad 怎么样(我知道它比 iphone 更快),但 iphone 喜欢 PNG 图像。这些加载速度比其他加载速度更快。
Replacing the image on the UIImageView should be enough (that would be my first idea). The problem you may be facing boils down to the speed. Once the images are loaded, the corresponding animation should be fast (assuming you will not load the same images twice).
I wouldn't write an OpenGL applicaton for this. It seems like an overkill.
Don't know about the ipad (I know it's faster than the iphone) but iphone liked PNG images. Those load faster than others.
如果您有 3D 对象网格,直接加载 3D 对象还是将其渲染为 360 帧的 .png(每个角度 1 个,假设某个设定的方位角)会更快吗?
If you had the 3d object mesh, would it be faster to load the 3d object directly, or to render it into 360 frames of .png (1 per angle, assuming a certain set azimuth)?