stagexl_particle 0.4.0+1

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.

http://www.stagexl.org/runtimes/particle_emitter.html

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.

https://github.com/bp74/StageXL_Particle/blob/master/example/example.dart

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.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.

example/example.dart

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 = new Stage(html.querySelector('#stage'));
  var renderLoop = new RenderLoop();
  renderLoop.addStage(stage);

  //-------------------------

  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 = new ParticleEmitter(particleConfig);
  particleEmitter.setEmitterLocation(400, 300);
  stage.addChild(particleEmitter);
  stage.juggler.add(particleEmitter);

  //-------------------------

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

  var glassPlate = new GlassPlate(800, 600);
  glassPlate.onMouseDown.listen(mouseEventListener);
  glassPlate.onMouseMove.listen(mouseEventListener);
  stage.addChild(glassPlate);

}

Use this package as a library

1. Depend on it

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


dependencies:
  stagexl_particle: ^0.4.0+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support 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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
88
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Jul 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: web

Primary library: package:stagexl_particle/stagexl_particle.dart with components: html.

Health suggestions

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

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

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

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

line 125 col 7: DO use curly braces for all flow control structures.

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

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

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

line 14 col 7: The value of the field '_rotationDelta' 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 49 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 21 col 6: The function '_ensureBool' isn't used.

Format lib/src/particle_color.dart.

Run dartfmt to format lib/src/particle_color.dart.

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
stagexl >=1.4.0 <2.0.0 1.4.0+3
Transitive dependencies
charcode 1.1.2
collection 1.14.11
convert 2.1.1
meta 1.1.7
petitparser 2.4.0
typed_data 1.1.6
xml 3.5.0
Dev dependencies
build_runner any
build_test any
build_web_compilers any

Admin