如果我们在iPhone SDK中使用图像,我们如何加速animation?
我有一系列的animation图像,比如图像1到1000。
我打算以统一的速度显示这些图像,以显示animation。
我想知道是否有什么方法可以加速animation? 我可以加快显示图像的速度吗?
请告诉我。
使用GIF
图像播放animation。 使用OpenGLES播放GIF文件是一种好的做法,我相信这是播放animation的最佳方式。
按照Git链接: https : //github.com/jamesu/glgif
🙂
有很多方法,但最简单的方法是将图像数组传递给UIImageView
属性animationImages
。 然后调用start Animating
stopAnimating
来启动UIImageView
的animation和stopAnimating
方法来停止animation。
UIImageView也有属性animationDuration
,它允许设置每个图像的持续时间。
你也可以使用OpenGL来渲染图像,这比UIImageView快得多。 因为OpenGL使用GPU。
解决方法是跳过animation的帧。 所以,如果你想加快速度,你将画出0,2,4,6帧或1,3,5,7的animation序列。 如果你想三倍的速度,你会画0,3,6,9等等。 这是跳过框架:)