tguerin / newton

An Easy To Use Particle Emitter
https://newton.7omtech.fr
MIT License
22 stars 7 forks source link

Newton logo

License: MIT pub package

Particle Emitter for Flutter

Newton is a highly configurable particle emitter package for Flutter that allows you to create captivating animations such as rain, smoke, explosions, and more. With Newton, you can easily add visually stunning effects to your Flutter applications.

Rain Smoke Pulse Explode Fountain
Rain Smoke Pulse Explode Fountain

Features

Installation

To use Newton, simply add it as a dependency in your pubspec.yaml file:

dependencies:
  newton_particles: ^0.1.8

Then, run flutter pub get to fetch the package.

Usage

  1. Import the Newton package:
import 'package:newton_particles/newton_particles.dart';
  1. Create a Newton widget and add it to your Flutter UI with the desired effects:
Newton(
    // Add any kind of effects to your UI
    // For example:
    activeEffects: [
        RainEffect(
            particleConfiguration: ParticleConfiguration(
                shape: CircleShape(),
                size: const Size(5, 5),
                color: const SingleParticleColor(color: Colors.black),
            ),
            effectConfiguration: const EffectConfiguration(),
        )
    ],
)

Try our effect configurator to tweak your effect.

Example

For a quick start, here's an example of creating a simple rain effect using Newton:

import 'package:flutter/material.dart';
import 'package:newton_particles/newton_particles.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Newton Rain Example')),
        body: Newton(
          activeEffects: [
            RainEffect(
                particleConfiguration: ParticleConfiguration(
                    shape: CircleShape(),
                    size: const Size(5, 5),
                    color: const SingleParticleColor(color: Colors.black),
                ),
                effectConfiguration: const EffectConfiguration()
            )
          ],
        ),
      ),
    );
  }
}

Documentation

For detailed documentation and examples, visit the Newton Documentation.

Contributing

We welcome contributions from the community! If you find any issues or have ideas for improvements, feel free to open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.


Note: This package is under active development, and breaking changes might be introduced in future versions until a stable 1.0.0 release. Please review the changelog when updating versions.