搜索插件、代码仓与 APP 分类

插件详情v2.0.0

image_sequence_animator

一个简单的控件,用于以完全自定义的控制方式动画显示一组图像,作为使用 GIF 文件的替代方案。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2010
喜欢数
80
Pub 分数
120

安装插件

flutter pub add image_sequence_animator

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 小部件,可精确控制图像序列的动画播放,支持对播放、定时和循环的完全控制。它作为 GIF 的轻量级替代方案,允许开发者使用单个图像帧创建流畅的动画。适用于 GIF 过大或不够灵活的自定义动画场景。该包支持所有主要平台,并提供直观的 API 来启动、暂停和重置动画。

适合场景

  • 自定义动画UI元素
  • 替换大型 GIF 文件
  • 交互式应用动画
  • 游戏角色动画
  • 带有逐帧效果的加载指示器

主要特点

  • 完整的播放控制
  • 支持任何图像格式
  • 跨平台兼容性
  • 可配置帧率
  • 循环选项
  • 与现有小部件的轻松集成

适合对象

  • 寻求GIF替代方案的开发者
  • 需要高性能动画的应用
  • 具有严格文件大小限制的项目
  • 交互式 UI 组件
  • 需要精确时间控制的动画

使用建议

  • 使用大量帧时内存占用更高
  • 需要预处理的图像序列
  • 不太适合非常长的动画
  • 手动管理帧加载
  • 与视频格式相比,内置效果有限

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

image_sequence_animator

Cosmos Software

Pub License

A simple widget for animating a set of images with full custom controls as an alternative to using a GIF file.

If you have a GIF file you would like to use with this package, I recommend EZGIF to convert your GIF file to an image sequence.

It is highly recommended to read the documentation and run the example project on a real device to fully understand and inspect the full range of capabilities.

Media | Description | How-to-Use

Recent

  • [isOnline] is added. If your [folderName] is an online path, this value should be set to true.

  • [waitUntilCacheIsComplete] is added. If you want the [ImageSequenceAnimator] to wait until the entire image sequence is cached, this value should be set to true i. Otherwise, the [ImageSequenceAnimator] will invoke [onReadyToPlay] and start playing if [isAutoPlay] is set to true when it approximates that the remaining caching can be completed without causing stutters. This value is only used if [isOnline] is set to true.

  • [cacheProgressIndicatorBuilder] is added. If you want to display a widget until the [ImageSequenceAnimator] is ready to be played, use this function.


Media

Watch on Youtube:

Image Sequence Animator

Description

This simple widget for animating a set of images (a.k.a an image sequence) with full custom controls as an alternative to using a GIF file.

GIF files are, as far as I know, not possible to control. With this package, you will have full control over your image sequence like controlling a video. You can loop, boomerang, change the color, play, pause, stop, skip, rewind, restart and more.

How-to-Use

First, add your image sequence to your assets and update the "pubspec.yaml" accordingly.

Then create an ImageSequenceAnimator widget as shown in the example:

ImageSequenceAnimator(
  "assets/ImageSequences/MyImageSequence",  //folderName 
  "Frame_",                                 //fileName
  0,                                        //suffixStart
  5,                                        //suffixCount 
  "png",                                    //fileFormat 
  60,                                       //frameCount
 {Key key,
  fps               : 60,
  isLooping         : false,
  isBoomerang       : false,
  isAutoPlay        : true,
  color             : Colors.white,
  onReadyToPlay     : _onReadyToPlay,
  onStartPlaying    : _onStartPlaying,
  onPlaying         : _onPlaying,
  onFinishPlaying   : _onFinishPlaying})

ImageSequenceAnimator(
  "https://www.domain.com/ImageSequences/MyImageSequence",  //folderName 
  "Frame_",                                                 //fileName
  0,                                                        //suffixStart
  5,                                                        //suffixCount 
  "png",                                                    //fileFormat 
  60,                                                       //frameCount
 {Key key,
  fps               :               60,
  isLooping         :               false,
  isBoomerang       :               false,
  isAutoPlay:                       true,
  isOnline:                         true,
  waitUntilCacheIsComplete:         true,
  cacheProgressIndicatorBuilder:    _cacheProgressIndicatorBuilder,
  color             :               Colors.white,
  onReadyToPlay     :               _onReadyToPlay,
  onStartPlaying    :               _onStartPlaying,
  onPlaying         :               _onPlaying,
  onFinishPlaying   :               _onFinishPlaying})
  
Widget _cacheProgressIndicatorBuilder(BuildContext _context , double _progress);  
void   _onReadyToPlay(ImageSequenceAnimatorState _imageSequenceAnimator);
void   _onStartPlaying(ImageSequenceAnimatorState _imageSequenceAnimator);
void   _onPlaying(ImageSequenceAnimatorState _imageSequenceAnimator);
void   _onFinishPlaying(ImageSequenceAnimatorState _imageSequenceAnimator); 

Further Explanations:

For a complete set of descriptions for all parameters and methods, see the documentation.

  • [isLooping] will override [isBoomerang] if both are set to true.
  • All [ImageSequenceProcessCallback] callbacks will return a reference to the created [ImageSequenceAnimator] state. You can save this instance for further actions.
  • Use [ImageSequenceAnimatorState]'s [void setIsLooping(bool isLooping)], [void setIsBoomerang(bool isBoomerang)], [void setColor(Color color)], [void play({double from: -1.0})], [void rewind({double from: -1.0})], [void pause()], [void skip(double value, {double percentage: -1.0})], [void restart()], [void stop()] methods for the corresponding actions.
  • Use [ImageSequenceAnimatorState]'s [bool get isLooping], [bool get isBoomerang], [double get currentProgress], [double get totalProgress], [double get currentTime] and [double get totalTime] methods to get the respective values.

Notes

I started using and learning Flutter only some weeks ago so this package might have some parts that don't make sense, that should be completely different, that could be much better, etc. Please let me know! Nicely!

Any help, suggestion or criticism is appreciated!

Cheers.





所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。