搜尋套件、儲存庫與 APP 分類

thanos_snap_effect 封面
套件詳情v0.0.9

thanos_snap_effect

高性能、高度可自訂且易於使用的 Flutter 'Thanos Snap' 效果。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2430
喜歡數
54
Pub 分數
160

安裝套件

flutter pub add thanos_snap_effect

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

The thanos_snap_effect 套件為 Flutter 應用提供高效率、可自訂的「Thanos Snap」動畫。它讓開發者能輕鬆在多個平台(包含 Android、iOS、Web、macOS、Windows 與 Linux)實作標誌性的響指效果——元素以戲劇性方式消失。透過順暢的過渡與廣泛的自訂選項,提升遊戲、互動式介面或趣味應用功能的使用者參與度。此套件輕量、文件完整,並以簡潔設計為目標,同時不犧牲彈性。

適用情境

  • 遊戲UI效果
  • 互動式應用程式動畫
  • 有趣的使用者介面
  • 數位敘事
  • 應用引導流程

主要特色

  • 高效能渲染
  • 跨平台支援
  • 可自訂的動畫速度
  • 可設定的漸隱與縮放效果
  • 與現有組件的輕鬆整合
  • 支援多種螢幕尺寸

適合對象

  • 尋求趣味動畫的 Flutter 開發者
  • 針對年輕受眾的應用
  • 遊戲化應用
  • UI/UX 設計師探索動態效果

使用建議

  • 可能不適合極簡設計風格
  • 需要仔細掌握時機以獲得最佳使用者體驗
  • 不適合對可存取性要求較高的介面
  • 效能可能在低階裝置上有所差異

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

High-performance, high-customizable, and easy-to-use "Thanos Snap" effect for Flutter.

Simple controller example      Animated list example

Getting started

IMPORTANT: This package uses the custom fragment shader, so you should include the shader file in your pubspec.yaml file.

flutter:
  shaders:
    - packages/thanos_snap_effect/shader/thanos_snap_effect.glsl

Usage

This package provides a 'Snappable' widget. The principle of using this widget is similar to "Transition" widgets, like "FadeTransition", "ScaleTransition", etc.

Just wrap your widget with the Snappable widget and pass the AnimationController (or any Animation descendant) object to the "animation" property. Then just start the animation and see the magic!

Snappable(
  animation: animationController, // AnimationController object, or any other animation object with double tween from 0.0 to 1.0
  child: MyWidget(), // Your widget that you want to animate
);

Check the example for more complex examples.

Customization

You can customize the effect by passing the "outerPadding" or "style" properties to the Snappable widget.

Snappable(
  animation: _animationController,
  child: MyWidget(),
  outerPadding: const EdgeInsets.all(40.0), // The padding around the widget where particles can appear. Default value is EdgeInsets.all(40.0) 
  style: SnappableStyle(
    particleLifetime: 0.6, // Lifetime of particle before it disappears. Default value is 0.6. Must be between 0.0 and 1.0
    fadeOutDuration: 0.3, // Duration of fade out animation of particle. Fade out effect starts in particleLifetime - fadeOutDuration and ends when particleLifetime ends. Default value is 0.3. Must be between 0.0 and particleLifetime
    particleSpeed: 1.0, // Speed of particles. Default value is 1.0
    particleSize: const SnappableParticleSize.squareFromRelativeWidth(0.01), // Size of 1 particle
  ),
);
Mastering the particleSize property

There are 2 ways to define the size of particles:

Relative to the size of the widget

SnappableParticleSize.relative(width: 0.01, height: 0.02) // 1% of the width and 2% of the height of the widget
SnappableParticleSize.squareFromRelativeWidth(0.01) // 1% of the width of the widget. The height will be calculated to keep the square shape
SnappableParticleSize.squareFromRelativeHeight(0.01) // 1% of the height of the widget. The width will be calculated to keep the square shape

Absolute size (in dp)

SnappableParticleSize.absoluteDp(width: 16, height: 8) // 16dp width and 8dp height

所屬分類

原始碼儲存庫

使用此套件的專案