stagexl_particle 0.4.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 61

The StageXL Particle library is an extension to the StageXL Library to show particle effects. You can use particle effects to simulate fire, smoke, explosions or similar things. Often those effects will make your game visually more appealing.

NOTE: as of version 0.10.0-dev, StageXL_Particle requires a Dart 2 SDK.

Particle Emitter #

The particle emitter is a DisplayObject you can add to the display list. It is also the origin where all particles are emitted. Use the particle designer on the StageXL homepage to configure all the parameters necessary to get a great looking particle emitter.

StageXL #

The StageXL library is intended for Flash developers who want to migrate their projects as well as their skills to HTML5. Therefore the library provides the familiar Flash API built on open web standards.

How To #

The StageXL Particle repository on GitHub contains an example how to use the Particle Emitter and how to add it to the Stage. Start with the Particle Designer to configure the particle effect as desired. Then copy the generated JSON string to your Dart project and simply create the ParticleEmitter as shown in the example. Don't forget to add the ParticleEmitter to the Juggler for the animation.

Build #

Build Status

changelog #

This file contains highlights of what changes on each version of the StageXL_Particle package. This file is normally updated whenever we push a new version to pub.

Pub version 0.4.1 #

  • Raised dependency to StageXL 1.4.1
  • Ready for Dart 2.4

Pub version 0.4.0 #

  • Raised dependency to StageXL 1.4.0
  • Ready for Dart 2.0 stable

Pub version 0.4.0-dev #

  • Raised dependency to StageXL 1.3.2-dev
  • Ready for Dart 2.0

Pub version 0.3.8 #

  • Added support for strong mode

Pub version 0.3.7 #

  • Updated to StageXL 1.0.0

Pub version 0.3.7 #

  • Updated to StageXL 0.13.0

Pub version 0.3.6 #

  • Updated to StageXL 0.12.0

Pub version 0.3.5+1 #

  • Updated to StageXL 0.11.0

Pub version 0.3.4 #

  • Updated to StageXL 0.10.2

Pub version 0.3.3 #

  • Updated to StageXL 0.10.0

Pub version 0.3.2 #

  • Updated pubspec package versions.

Pub version 0.3.1 #

  • Added dedicated Canvas2D and WebGL renderer

Pub version 0.3.0 #

  • Support for WebGL renderer in StageXL

Pub version 0.2.0 #

  • Set version of dependencies according to Dart 1.0 release.

Pub version 0.1.1 #

  • Some minor changes to align with the latest Dart changes.

Pub version 0.1.0 #

  • Moved Particle emitter runtime from StageXL to StageXL_Particle.


library example01;

import 'dart:html' as html;
import 'package:stagexl/stagexl.dart';
import 'package:stagexl_particle/stagexl_particle.dart';

void main() {
  StageXL.stageOptions.renderEngine = RenderEngine.WebGL;
  StageXL.stageOptions.backgroundColor = Color.Black;

  var stage = Stage(html.querySelector('#stage'));
  var renderLoop = RenderLoop();


  var particleConfig = {
    "maxParticles": 2000,
    "duration": 0,
    "lifeSpan": 0.7,
    "lifespanVariance": 0.2,
    "startSize": 16,
    "startSizeVariance": 10,
    "finishSize": 53,
    "finishSizeVariance": 11,
    "shape": "circle",
    "emitterType": 0,
    "location": {"x": 0, "y": 0},
    "locationVariance": {"x": 5, "y": 5},
    "speed": 100,
    "speedVariance": 33,
    "angle": 0,
    "angleVariance": 360,
    "gravity": {"x": 0, "y": 0},
    "radialAcceleration": 20,
    "radialAccelerationVariance": 0,
    "tangentialAcceleration": 10,
    "tangentialAccelerationVariance": 0,
    "minRadius": 0,
    "maxRadius": 100,
    "maxRadiusVariance": 0,
    "rotatePerSecond": 0,
    "rotatePerSecondVariance": 0,
    "compositeOperation": "source-over",
    "startColor": {"red": 1, "green": 0.74, "blue": 0, "alpha": 1},
    "finishColor": {"red": 1, "green": 0, "blue": 0, "alpha": 0}

  var particleEmitter = ParticleEmitter(particleConfig);
  particleEmitter.setEmitterLocation(400, 300);


  var mouseEventListener = (MouseEvent me) {
    if (me.buttonDown) particleEmitter.setEmitterLocation(me.localX, me.localY);

  var glassPlate = GlassPlate(800, 600);

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  stagexl_particle: ^0.4.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:stagexl_particle/stagexl_particle.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/src/particle.dart. (-1 points)

Analysis of lib/src/particle.dart reported 2 hints:

line 12 col 7: The value of the field '_rotation' isn't used.

line 13 col 7: The value of the field '_rotationDelta' isn't used.

Fix lib/src/particle_emitter.dart. (-1 points)

Analysis of lib/src/particle_emitter.dart reported 2 hints:

line 34 col 10: The value of the field '_shape' isn't used.

line 56 col 10: The value of the field '_compositeOperation' isn't used.

Fix lib/src/particle_render_program.dart. (-0.50 points)

Analysis of lib/src/particle_render_program.dart reported 1 hint:

line 48 col 3: Avoid return types on setters.

Fix lib/stagexl_particle.dart. (-0.50 points)

Analysis of lib/stagexl_particle.dart reported 1 hint:

line 20 col 6: The declaration '_ensureBool' isn't referenced.

Maintenance suggestions

The package description is too short. (-7 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
stagexl >=1.4.1 <2.0.0 1.4.2
Transitive dependencies
charcode 1.1.2
collection 1.14.12
convert 2.1.1
meta 1.1.8
petitparser 3.0.0
typed_data 1.1.6
xml 3.7.0
Dev dependencies
build_runner any
build_test any
build_web_compilers any
pedantic any