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

GitHub 代码仓manjav/particular

特定的

使用此高性能 Flutter 粒子系统小部件增强您的应用或游戏视觉效果

特定的 项目封面
星标
17
复刻
0
最近推送(UTC)
2025年2月9日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

Particular Logo

Enhance your app or game visuals with this high-performance Flutter Particles System widget. Utilize JSON or programmatic configuration, seamlessly integrating with popular particles editors for effortless customization.

  • Customizable (live) Particle Effects.
  • Ready Presets (JSON Configs).
  • Seamless Integration with Editors.
  • Optimized Performance with 1~10k particle at frame

    Whether you're a designer or developer, Particular empowers you to bring your creative visions with ease.


    - Some Presets:

    Meteor Galaxy Snow Meteor


    - Installation

    Add particular to your pubspec.yaml file:
    For detailed installation instructions, refer to the installation guide on pub.dev.


    - Configurate your particles

    You have two options for configuring your particles:

    1. Using Editors:

    Generate your particles system configurations by Particular Editor.


    1. Programmatic Configuration:
      Manually configure your particle controller in code. Refer to the following steps for more details.

    - Getting Started with Coding

    Follow these steps to integrate the particles system into your Flutter app:

    I. Insert Particle Files into Your Project:
    The Particular Editor exports one or multiple particle layers. For each particle layer, it generates a configuration file (configs.json) and a related image file (texture.png). In the configuration file, there is a node named textureFileName, which refers to the image file. Place the image and configs.json file in your project's assets folder, and add the necessary assets entry in your pubspec.yaml file.

    assets:
      - assets/configs.json
      - assets/texture.png
    

    https://docs.flutter.dev/ui/assets/assets-and-images


    II. Initialize the Particles Controller in `initState`:

    To use this library, import package:particular/particular.dart.

    final _particleController = ParticularController();
    ...
    @override
    void initState() {
      _loadParticleAssets();
      super.initState();
    }
    
    // Load configs and texture of particle
    Future<void> _loadParticleAssets() async {
    
      // Load particle configs file
      String json = await rootBundle.loadString("assets/configs.json");
      final configsData = jsonDecode(json);
    
      // Load particle texture file
      ByteData  bytes = await rootBundle.load("assets/${configsData["textureFileName"]}");
      ui.Image texture = await loadUIImage(bytes.buffer.asUint8List());
    
      // Add particles layer
      _particleController.addLayer(
        texture: frameInfo.image, // Remove in default-texture case
        configsData: configsData, // Remove in programmatic configuration case
      );
    }
    

    III. Add the Particular widget in your widget three:

    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: Scaffold(
          backgroundColor: Colors.black,
          body: Particular(
            controller: _particleController,
          ),
        ),
      );
    }
    

    IIII. Live Update Particle Layer:

    _particleController.layers.first.update(
        maxParticles: 100,
        lifespan:1.2,
        speed:100,
        angle:30,
    );
    

    You can also use different image types supported by Flutter, with varying names and locations, following the guidelines below:

    {
      "textureFileName": "images/particle_snow.webp"
    }
    
    assets:
      - assets/data/particle_snow.json
      - assets/images/particle_snow.webp
    
    ...
    
    // Load particle configs file
    String json = await rootBundle.loadString("assets/data/particle_snow.json");
    
    ...
    

    This revised README provides clear installation instructions, options for configuring particles, and steps for integrating and customizing the particle system in your Flutter app. If you have any questions or need further assistance, don't hesitate to ask!

  • Mansour Djawadi GitHub avatar
    GitHub 作者

    Mansour Djawadi ↗

    Istanbul
    语言DartRubyHTMLShellSwift

    分类

    此仓库发布的插件

    使用的依赖

    依赖清单 4 项

    • flutter{"sdk":"flutter"}
    • image^4.2.0
    • flutter_test开发依赖{"sdk":"flutter"}
    • flutter_lints开发依赖^5.0.0

    如何选择适合项目的代码仓?

    先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

    1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
    2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
    3. 使用前在 GitHub 核对 README、许可证与 Issues。

    来源与维护

    “A repository is the most basic element of GitHub.”

    GitHub Docs — About repositories ↗