FLAnimatedImage

简介:

FLAnimatedImage

FLAnimatedImage is a performant animated GIF engine for iOS:

FLAnimatedImage是一个播放gif图片的引擎:

  • Plays multiple GIFs simultaneously with a playback speed comparable to desktop browsers 可以异步播放多个gif图片,不会降低速度,与电脑上面播放的效果一致.
  • Honors variable frame delays 支持帧率的不同
  • Behaves gracefully under memory pressure 内存占用率小
  • Eliminates delays or blocking during the first playback loop 重复播放时,不会有延时阻塞感
  • Interprets the frame delays of fast GIFs the same way modern browsers do 

It's a well-tested component that powers all GIFs in Flipboard. To understand its behavior it comes with an interactive demo:

 这个已经经过了很多的测试,保证很稳定。你可以看看下面demo显示:

 

 

Who is this for? 用在什么地方?

  • Apps that don't support animated GIFs yet App还不支持GIF显示的
  • Apps that already support animated GIFs but want a higher performance solution App已经使用了GIF图片,但是效果不好的
  • People who want to tinker with the code (the corresponding blog post is a great place to start; also see the To Do section below) 那些想要改进这份代码的人

 

Installation & Usage

FLAnimatedImage is a well encapsulated drop-in component. Simply replace your UIImageView instances with instances of FLAnimatedImageView to get animated GIF support. There is no central cache or state to manage.

FLAnimatedImage是一个继承与UIImageView的子类,你只需要简单的用FLAnimatedImage替换UIImageView即可支持GIF图片的显示。没有中心缓存或者是状态管理操作。

If using CocoaPods, the quickest way to try it out is to type this on the command line:

如果你使用CocoaPods,你可以用以下一句话来集成:

$ pod try FLAnimatedImage

To add it to your app, copy the two classes FLAnimatedImage.h/.m and FLAnimatedImageView.h/.minto your Xcode project or add via CocoaPods by adding this to your Podfile:

你也可以将FLAnimatedImage.h/.m 与 FLAnimatedImageView.h/.m拷贝到你的项目中即可。

pod 'FLAnimatedImage', '~> 1.0'

In your code, #import "FLAnimatedImage.h", create an image from an animated GIF, and setup the image view to display it:

在你的代码中,导入 #import "FLAnimatedImage.h",然后创建出GIF图片,加载出来显示即可:

FLAnimatedImage *image = [FLAnimatedImage animatedImageWithGIFData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://raphaelschaad.com/static/nyan.gif"]]]; FLAnimatedImageView *imageView = [[FLAnimatedImageView alloc] init]; imageView.animatedImage = image; imageView.frame = CGRectMake(0.0, 0.0, 100.0, 100.0); [self.view addSubview:imageView];

It's flexible to integrate in your custom image loading stack and backwards compatible to iOS 6.

兼容性很好,即时是iOS6也能跑的很顺畅。

It uses ARC and the Apple frameworks QuartzCoreImageIOMobileCoreServices, andCoreGraphics.

使用ARC,以及QuartzCore,ImageIO,MobileCoreServices,andCoreGraphics框架

It has fine-grained logging. By default, it uses NSLog. However, if your project usesCocoaLumberjack, it automatically can detect that and use CocoaLumberjack to send logs to the configured output.

Since FLAnimatedImage is licensed under MIT, it's compatible with the terms of using it for any app on the App Store.

 

To Do

  • Support other animated image formats such as APNG or WebP
  • Integration into network libraries and image caches
  • Investigate whether FLAnimatedImage should become a UIImage subclass
  • Smarter buffering
  • Bring demo app to iOS 6 and iPhone

This has successfully shipped to many people as is, but please do come with your questions, issues and pull requests!

Feel free to reach out to @RaphaelSchaad for further help.

 

Select apps using FLAnimatedImage

Using FLAnimatedImage in your app? Let me know!

目录
相关文章
|
安全 算法 Java
|
9月前
|
存储 并行计算 Java
Python读取.nc文件的方法与技术详解
本文介绍了Python中读取.nc(NetCDF)文件的两种方法:使用netCDF4和xarray库。netCDF4库通过`Dataset`函数打开文件,`variables`属性获取变量,再通过字典键读取数据。xarray库利用`open_dataset`打开文件,直接通过变量名访问数据。文中还涉及性能优化,如分块读取、使用Dask进行并行计算以及仅加载所需变量。注意文件路径、变量命名和数据类型,读取后记得关闭文件(netCDF4需显式关闭)。随着科学数据的增长,掌握高效处理.nc文件的技能至关重要。
1596 0
|
4月前
|
C语言
数据结构------栈(Stack)和队列(Queue)
数据结构------栈(Stack)和队列(Queue)
31 0
|
Java Linux 调度
加速你的Python程序(线程/进程池)
加速你的Python程序(线程/进程池)
449 0
|
3天前
|
人工智能 自然语言处理 Shell
深度评测 | 仅用3分钟,百炼调用满血版 Deepseek-r1 API,百万Token免费用,简直不要太爽。
仅用3分钟,百炼调用满血版Deepseek-r1 API,享受百万免费Token。阿里云提供零门槛、快速部署的解决方案,支持云控制台和Cloud Shell两种方式,操作简便。Deepseek-r1满血版在推理能力上表现出色,尤其擅长数学、代码和自然语言处理任务,使用过程中无卡顿,体验丝滑。结合Chatbox工具,用户可轻松掌控模型,提升工作效率。阿里云大模型服务平台百炼不仅速度快,还确保数据安全,值得信赖。
143204 24
深度评测 | 仅用3分钟,百炼调用满血版 Deepseek-r1 API,百万Token免费用,简直不要太爽。
|
5天前
|
人工智能 API 网络安全
用DeepSeek,就在阿里云!四种方式助您快速使用 DeepSeek-R1 满血版!更有内部实战指导!
DeepSeek自发布以来,凭借卓越的技术性能和开源策略迅速吸引了全球关注。DeepSeek-R1作为系列中的佼佼者,在多个基准测试中超越现有顶尖模型,展现了强大的推理能力。然而,由于其爆火及受到黑客攻击,官网使用受限,影响用户体验。为解决这一问题,阿里云提供了多种解决方案。
16579 37
|
13天前
|
机器学习/深度学习 人工智能 自然语言处理
PAI Model Gallery 支持云上一键部署 DeepSeek-V3、DeepSeek-R1 系列模型
DeepSeek 系列模型以其卓越性能在全球范围内备受瞩目,多次评测中表现优异,性能接近甚至超越国际顶尖闭源模型(如OpenAI的GPT-4、Claude-3.5-Sonnet等)。企业用户和开发者可使用 PAI 平台一键部署 DeepSeek 系列模型,实现 DeepSeek 系列模型与现有业务的高效融合。
|
5天前
|
并行计算 PyTorch 算法框架/工具
本地部署DeepSeek模型
要在本地部署DeepSeek模型,需准备Linux(推荐Ubuntu 20.04+)或兼容的Windows/macOS环境,配备NVIDIA GPU(建议RTX 3060+)。安装Python 3.8+、PyTorch/TensorFlow等依赖,并通过官方渠道下载模型文件。配置模型后,编写推理脚本进行测试,可选使用FastAPI服务化部署或Docker容器化。注意资源监控和许可协议。
1292 8
|
13天前
|
人工智能 搜索推荐 Docker
手把手教你使用 Ollama 和 LobeChat 快速本地部署 DeepSeek R1 模型,创建个性化 AI 助手
DeepSeek R1 + LobeChat + Ollama:快速本地部署模型,创建个性化 AI 助手
3408 117
手把手教你使用 Ollama 和 LobeChat 快速本地部署 DeepSeek R1 模型,创建个性化 AI 助手

热门文章

最新文章