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

particle_field 封面
套件詳情v1.0.0

particle_field

一個用於在您的 UI 中添加高效率自定義粒子效果的 Flutter 小部件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1150
喜歡數
143
Pub 分數
150

安裝套件

flutter pub add particle_field

套件介紹

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

一個高效率的 Flutter 小組件,讓開發者能夠為 UI 創建自訂的粒子效果,擁有流暢的動畫與即時互動功能。由 gskinner.com 所開發,支援多個平台,包括 Android、iOS、Web、macOS、Windows 與 Linux。此套件運用高效能的繪製技術,提供視覺豐富的背景、動態漸層與沉浸式的視覺體驗,同時不影響效能。非常適合透過細膩或戲劇性的動畫元素來提升應用程式介面。

適用情境

  • 創建動畫背景效果
  • 增強啟動畫面
  • 新增互動式視覺反饋
  • 設計沉浸式遊戲介面
  • 透過動態視覺化資料
  • 改善應用程式入門體驗

主要特色

  • 高效能渲染
  • 可自訂的粒子行為
  • 即時互動支援
  • 跨平台相容性
  • 基於著色器的動畫
  • 可設定的發射模式

適合對象

  • 尋求視覺魅力的UI設計師
  • 使用 Flutter 的遊戲開發者
  • 希望擁有動態背景的應用程式創作者
  • 互動式原型建構器
  • 創意數位產品團隊

使用建議

  • 可能影響低階裝置的效能
  • 需要理解粒子系統概念
  • 有限的內建預設
  • 最適合現代硬體
  • 需要針對行動裝置進行仔細優化
  • 不適合用於靜態UI元件

原始 README

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

Particle Field

A Flutter Widget for adding high performance custom particle effects to your UI.

Simple Example

Easy to use: just write a simple onTick handler to manage a list of particles. Architected to be highly extensible. Utilizes CustomPainter and drawAtlas to offer exceptional performance.

// NOTE: this example uses `rnd` (see "Complimentary Libraries" below)
ParticleField field = ParticleField(
  spriteSheet: sparkleSpriteSheet,
  // top left will be 0,0:
  origin: Alignment.topLeft,
  // onTick is where all the magic happens:
  onTick: (controller, elapsed, size) {
    List<Particle> particles = controller.particles;
    // add a new particle each frame:
    particles.add(Particle(x: rnd(size.width), vx: rnd(-1, 1)));
    // update existing particles:
    for (int i = particles.length - 1; i >= 0; i--) {
      Particle particle = particles[i];
      // call update, which automatically adds vx/vy to x/y
      // add some gravity (ie. increase vertical velocity)
      // and increment the frame
      particle.update(vy: particle.vy + 0.1, frame: particle.frame + 1);
      // remove particle if it's out of bounds:
      if (!size.contains(particle.toOffset())) particles.removeAt(i);
    }
  },
)

See the API Reference for more information.

Complimentary Libraries

The rnd package makes working with random values in your particle systems much simpler. For example, if you wanted 20% of your particles to move left, and 80% right at a velocity of between 2 and 5:

particle.vx = rnd(2, 5) * rnd.getSign(0.8)

If you're looking to add animated effects to your UI in addition to particles, check out the Flutter Animate library for pre-made effects, custom effects, and simplified animated builders.

Text("Hello").animate().fadeIn().slide()

所屬分類

原始碼儲存庫

使用此套件的專案