ParticleSun is a fast, lightweight particle engine that uses 3D vectors for its calculations, allowing for the particles to be viewed in a three-dimensional environment. It’s expandable and comes with an effect explorer, code generator and a fully-documented API.
Sample
package { import com.blueflamedev.effects.ParticleSeed; import com.blueflamedev.events.ParticleEvent; import com.blueflamedev.math.Vector3D; import flash.display.Bitmap; import flash.display.Sprite; import flash.geom.Rectangle; public class Bubbles extends Sprite { //the particle generator private var bubbleSeed:ParticleSeed; //the background private var bg:Sprite; //holds the particles and particle generator private var holder:Sprite; public function Bubbles() { stage.align = "topLeft"; stage.scaleMode = "noScale"; bg = new Bg(); addChild(bg); holder = new Sprite(); addChild(holder); holder.y = bg.height / 2;//sets the z-axis vanishing point in the middle (rather than the upper-left) holder.x = bg.width / 2; createBubbleSeed(); //set all the variables for the particle effect } //creates the particle system private function createBubbleSeed():void { bubbleSeed = new ParticleSeed(holder); bubbleSeed.particle = Bubble; // (set the particle to the bubble graphic) bubbleSeed.bounds = new Rectangle(-750, 300, 1500, 10); // (the bubbles will spawn anywhere within this rectangle) bubbleSeed.force = new Vector3D(0, -.2, 0); // (add gravity (x, y, z)) bubbleSeed.setMagnitude(0, 0); //no initial trajectory bubbleSeed.releaseInterval = 250; // (release one bubble per half second bubbleSeed.duration = 15000; // (bubbles fade out after 15,000 ms) bubbleSeed.start(); // (start propagation) holder.addChild(bubbleSeed); // (add the seed to the stage). bubbleSeed.addEventListener(ParticleEvent.CREATE, onParticleCreate); } //randomly places the bubbles on the Z axis when they're created. private function onParticleCreate(event:ParticleEvent):void { bubbleSeed.z = Math.random() * 600; } } }
New: ParticleSun (fast, lightweight particle engine that uses 3D vectors for its calculations) http://t.co/hiOmWjsM #as3 #flash #gamedev