Milky particle engine started out as a simple toolkit consists of 3 classes: manager, particle and controls classes, which works well on small scale projects.

After looking through various particle system APIs including C++ version, I found that Flint by Richard Lord is the most flexible way among those as it has separated particle initiation and action controls. So to create a flexible engine, I have re-factored many times during last 3 months and here we have Milky particle engine beta 0.6.8. Currently it does not support 3d but maybe will do in the future.
I have tried to make the API as simple as possible and have borrowed some of my Domo tween engine codes too. Basically Milky is a manager class that is similar to Domo and I have also created several effect presets (only Smoke at moment) so here is a simple usage:
1 | Milky.addEffect(target_mc, new Smoke()); |
First you pass in the target display container then the effect. Smoke color can be changed by passing uint into constructor, e.g.- new Smoke(0xffffff). Of course we can add as many effects as you want and if we want to stop the effects, there are 2 ways:
1 2 | // Stop all effects Milky.stopAll(); |
or reference Milky instance and call ‘stop()’ method since Milky.addEffect() will return Milky instance:
1 2 3 4 5 6 | // We have 2 smoke effects. var milky:Milky = Milky.addEffect(target_mc, new Smoke()); Milky.addEffect(target_mc, new Smoke()); // Just stop the first one. Milky.stop(milky); |
All presets are extending Emitter class so if we want to create customised effect, we first create an Emitter instance and add initial states and controls:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | // Create new Emitter instance emitter = new Emitter(); // Add counter, partitle emission per second. emitter.addCounter(new Steady(30)); // Add initial particle states. emitter.addState(new Life(3)); emitter.addState(new Size(4)); emitter.addState(new Color(0xff00ff)); emitter.addState(new Velocity(new DiscDomain(null,300, 0))); emitter.addState(new Position(new PointDomain(300,200))); emitter.addState(new DisplayClass(Line)); // Add controls, particle's behaviors. emitter.addControl(new Age()); emitter.addControl(new Move()); emitter.addControl(new Gravity(100)); emitter.addControl(new Friction(0.96)); emitter.addControl(new Grow(1,.5)); emitter.addControl(new Fade(0.6,0)); emitter.addControl(new RotateToDirection()); // Add filter. emitter.addFilter(new BlurFilter(2,2,1)); // Add emitter to Milky engine for rendering. Milky.addEffect(target_mc, emitter, Milky.RENDER_BITMAP); |
Currently Milky particle engine has only 2 rendering methods, default is sprite rendering and another one is bitmap rendering. To change rendering method, passing 3rd parameter into ‘addEffect’ method like above example.
Download Milky particle engine beta 0.6.8 here.
No user commented in " Milky Particle Engine beta 0.6.8 "
Follow-up comment rss or Leave a TrackbackLeave A Reply