简体   繁体   English

核心动画的图像序列动画

[英]Image sequence animation with Core Animation

I'm currently using a UIImageView with an array of images to create a small looping animation sequence with about 20 images in there (at 320x480). 我目前正在使用带有图像数组的UIImageView来创建一个小的循环动画序列,其中有大约20个图像(320x480)。 Whilst this works okay for 20 - 30 images, any more and the app quits on the iphone. 虽然这适用于20 - 30张图片,但更多和应用程序退出iphone。 There is nothing else in my test app at the moment so I know it's just down to the animationImages sequence. 目前我的测试应用程序中没有其他任何内容,因此我知道它仅限于animationImages序列。

Has anyone come across any samples of doing this type of thing through Core Animation to achieve better performance and allow many more images? 有没有人通过Core Animation遇到任何做这类事情的样本,以获得更好的性能并允许更多的图像? From what I've read it sounds like its possible to set up a ton of CALayers and put an image in each, and then create the animation by manipulating the layers on and off in sequence. 从我所读到的内容来看,它可以设置大量的CALayers并在每个中放置一个图像,然后通过依次操作图层来创建动画。 Is this a good way to do it? 这是一个很好的方法吗?

Or, alternatively, as I'm basically after the effect of a looping movie, is there a way to use the moviecontroller to achieve the effect without it fading in and out at the start and at the end? 或者,或者,因为我基本上是在循环电影的效果之后,有没有办法使用moviecontroller来实现效果,而不会在开始和结束时淡入淡出?

I'd be grateful for any pointers. 我会感激任何指针。 Many thanks. 非常感谢。

This could be a simple memory issue. 这可能是一个简单的内存问题。 20 images (320x480) is about 3 MB of memory, assuming 8bpp (if they're higher color, obviously even more). 20个图像(320x480)约为3 MB的内存,假设8bpp(如果它们的颜色更高,显然更多)。 You might try loading and unloading as needed (though, of course, that'll mean rolling your own animation, rather than using UIImageView). 您可以根据需要尝试加载和卸载(当然,这意味着滚动您自己的动画,而不是使用UIImageView)。

Sounds like a simple memory issue. 听起来像一个简单的内存问题。

You could load one or two frames at a time, or actually play a movie instead. 您可以一次加载一个或两个帧,或者实际播放电影。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM