iPhone动画帧速率和帧数 [英] iphone animating frame rate and number of frames

查看:367
本文介绍了iPhone动画帧速率和帧数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个客户希望对大图像进行动画处理(305x332)的应用程序。客户希望在1.75秒内循环播放50帧。我发现该应用的处理速度非常慢。启动,响应触摸和关机很慢。在iPhone本身上,该应用程序通常会崩溃或锁定手机。请参见下面的代码。我的问题:

I am working on an app where the customer wants to animate large images (305x332). The customer wants 50 frames in 1.75 seconds to animate in a loop. I am finding that the app is very slow with this much processing. It is slow to start, respond to touches and to shutdown. On the iPhone it self, the app will often crash or lockup the phone. See the code below. My question(s):


  1. 我是不是在做一些导致性能不佳的事情,或者问50帧太多?

  2. 是否有关于动画中帧数和动画速度的最佳实践?

  3. 是否有关于动画中图像大小的最佳实践? ?

请告诉我。这是代码...

Please let me know. Here is the code...

NSMutableArray *tempArray = [[NSMutableArray alloc] init];
for(int i = 1; i <= 50; i++)
{

    [tempArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%@-%d-%04d.JPG",[constitution getConstitutionWord], constitution.getAnimationEnum, i]]];  
}


backgroundImage.animationImages = tempArray;
[tempArray release];
backgroundImage.animationDuration = 1.75; // seconds 
backgroundImage.animationRepeatCount = 0; // 0 = loops forever 
[backgroundImage startAnimating];   


推荐答案

我认为这个问题要问的太多了iPhone。根据我的fag数据包,解压缩后的图像大约占用21Mb。这可能会导致您的应用仅因内存使用情况而在手机上终止。将大量数据转移到帧缓冲区中也会导致电话问题。

I think this is a little too much to ask of the iPhone. Decompressed your images take up about 21Mb according to my fag packet. This will likely cause your app to be terminated on the phone just through memory usage. Shifting that much data into the framebuffer is also going to cause the phone problems.

我认为您需要使用更合适的动画技术。在305 * 322时〜30fps对我来说听起来像是视频。视频的压缩方式无需立即将所有解压缩的帧保存在内存中。可悲的是,如果您想在不将整个屏幕交给内置控件的情况下显示视频,则必须构建自己的播放器-VLC已移植到iPhone,因此可以作为一个很好的起点。

I think you need to use a more suitable animaton technology. ~30fps at 305*322 sounds like video to me. Video is compressed in such a way that you don't need to hold all of the decompressed frames in memory at once. Sadly, if you want to display video without giving over the whole screen to the built in control, you are going to have to build your own player - VLC has been ported to iPhone so could make a good starting point.

这篇关于iPhone动画帧速率和帧数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆