一個 Flutter 小部件,可精確動畫化影像序列,並完全控制播放、定時與循環。它作為 GIF 的輕量級替代方案,讓開發者能使用單獨的影像幀創造流暢的動畫。適用於 GIF 太大或不夠彈性的自訂動畫情境。此套件支援所有主要平台,並提供直覺的 API 來啟動、暫停和重設動畫。
適用情境
自定義動畫UI元素
取代大型 GIF 檔案
互動式應用動畫
遊戲角色動畫
帶有逐幀效果的加載指示器
主要特色
完整的播放控制
支援任何影像格式
跨平台相容性
可設定幀率
循環選項
與現有小部件的輕鬆整合
適合對象
尋求GIF替代方案的開發者
需要高性能動畫的應用
具有嚴格檔案大小限制的項目
互動式 UI 組件
需要精確時間控制的動畫
使用建議
使用大量幀時記憶體佔用更高
需要預處理的圖像序列
不太適合非常長的動畫
手動管理幀加載
與影片格式相比,內建效果較少
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
image_sequence_animator
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.
[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:
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:
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 [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!