Flint Particle System Forum - RGB particle fun 2011-12-13T00:39:16+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=3#Comment_3 2008-02-23T10:46:40+00:00 2008-05-20T10:10:22+01:00 sandersnake http://flintparticles.org/forum/account.php?u=4 First of all great stuff your sharing with us Richard! I experimented with it and made a nice RGB particle experiment. Check it out at www.actionscripter.nl I think the blur filter also could ...
I experimented with it and made a nice RGB particle experiment.
Check it out at www.actionscripter.nl

I think the blur filter also could be implemented with a bitmapemitter instead of the enter frame loop.
If you got any suggestions?

Source Code:

import flash.geom.Point;
import org.flintparticles.actions.*;
import org.flintparticles.counters.*;
import org.flintparticles.displayObjects.*;
import org.flintparticles.emitters.*;
import org.flintparticles.initializers.*;
import org.flintparticles.zones.*;

import com.afcomponents.common.display.*;
import com.afcomponents.common.graphics.*;

var emitter:DisplayObjectEmitter = new DisplayObjectEmitter();
emitter.setCounter( new Blast( 50 ) );
emitter.addInitializer( new ImageClass( Dot, 1 ) );
var lz:LineZone = new LineZone( new Point( stage.stageWidth/3, 3*stage.stageHeight/4 ), new Point( 2*stage.stageWidth/3, 3*stage.stageHeight/4) );
emitter.addInitializer( new Position( lz ) );
emitter.addInitializer( new Velocity( new PointZone( new Point( 0, 25 ) ) ) );
emitter.addInitializer( new ColorInit( 0xFF00FF00, 0xFFFFFFFF ) );
emitter.addAction( new Move() );
emitter.addAction( new Accelerate(0, 0) );
emitter.addAction( new GravityWell(25, stage.stageWidth/2, 2*stage.stageHeight/3) );

addChild( emitter );
emitter.start();
emitter.runAhead( 0 );

var emitter2:DisplayObjectEmitter = new DisplayObjectEmitter();
emitter2.setCounter( new Blast( 50 ) );
emitter2.addInitializer( new ImageClass( Dot, 1 ) );
var lz2:LineZone = new LineZone( new Point( stage.stageWidth/4, stage.stageHeight/3 ), new Point( stage.stageWidth/4, stage.stageHeight/2) );
emitter2.addInitializer( new Position( lz2 ) );
emitter2.addInitializer( new Velocity( new PointZone( new Point( 50, 0 ) ) ) );
emitter2.addInitializer( new ColorInit( 0xFF0000FF, 0xFFFFFFFF ) );
emitter2.addAction( new Move() );
emitter2.addAction( new GravityWell(15, stage.stageWidth/4, stage.stageHeight/3) );

addChild( emitter2 );
emitter2.start();
emitter2.runAhead( 0 );

var emitter3:DisplayObjectEmitter = new DisplayObjectEmitter();
emitter3.setCounter( new Blast( 50 ) );
emitter3.addInitializer( new ImageClass( Dot, 1 ) );
var lz3:LineZone = new LineZone( new Point( 3*stage.stageWidth/4, stage.stageHeight/3 ), new Point( 3*stage.stageWidth/4, stage.stageHeight/2) );
emitter3.addInitializer( new Position( lz3 ) );
emitter3.addInitializer( new Velocity( new PointZone( new Point( -50, 0 ) ) ) );
emitter3.addInitializer( new ColorInit( 0xFFFF0000, 0xFFFFFFFF ) );
emitter3.addAction( new Move() );
emitter3.addAction( new GravityWell(15, 3*stage.stageWidth/4, stage.stageHeight/3) );

addChild( emitter3 );
emitter3.start();
emitter3.runAhead( 0 );

var bmd:BitmapData = new BitmapData(550, 400, true, 0xFFFFFF);
var bm:Bitmap = new Bitmap(bmd);
addChild(bm);

var bf:BlurFilter = new BlurFilter(2, 2, 1);

addEventListener(Event.ENTER_FRAME, loop);

function loop(e:Event):void
{
bmd.draw(emitter);
bmd.draw(emitter2);
bmd.draw(emitter3);
bmd.applyFilter(bmd, bmd.rect, new Point(0,0), bf);
//bmd.applyFilter(bmd, bmd.rect, new Point(0,0), cmf);
//bmd.scroll(0, 3);
}
]]>
RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=5#Comment_5 2008-02-23T14:30:31+00:00 2011-12-13T00:39:16+00:00 Richard http://flintparticles.org/forum/account.php?u=1 I love it. As you say, you could use a BitmapEmitter and place the blur inside it. The code would look like this. import flash.geom.Point; import org.flintparticles.actions.*; import ...
As you say, you could use a BitmapEmitter and place the blur inside it. The code would look like this.

import flash.geom.Point;
import org.flintparticles.actions.*;
import org.flintparticles.counters.*;
import org.flintparticles.displayObjects.*;
import org.flintparticles.emitters.*;
import org.flintparticles.initializers.*;
import org.flintparticles.zones.*;

var emitter:BitmapEmitter = new BitmapEmitter();
emitter.setCounter( new Blast( 50 ) );
emitter.addInitializer( new SharedImage( new Dot( 1 ) ) );
var lz:LineZone = new LineZone( new Point( stage.stageWidth/3, 3*stage.stageHeight/4 ), new Point( 2*stage.stageWidth/3, 3*stage.stageHeight/4) );
emitter.addInitializer( new Position( lz ) );
emitter.addInitializer( new Velocity( new PointZone( new Point( 0, 25 ) ) ) );
emitter.addInitializer( new ColorInit( 0xFF00FF00, 0xFFFFFFFF ) );
emitter.addAction( new Move() );
emitter.addAction( new Accelerate(0, 0) );
emitter.addAction( new GravityWell(25, stage.stageWidth/2, 2*stage.stageHeight/3) );
emitter.addFilter( new BlurFilter( 2, 2, 1 ) );
addChild( emitter );
emitter.start();

var emitter2:BitmapEmitter = new BitmapEmitter();
emitter2.setCounter( new Blast( 50 ) );
emitter2.addInitializer( new SharedImage( new Dot( 1 ) ) );
var lz2:LineZone = new LineZone( new Point( stage.stageWidth/4, stage.stageHeight/3 ), new Point( stage.stageWidth/4, stage.stageHeight/2) );
emitter2.addInitializer( new Position( lz2 ) );
emitter2.addInitializer( new Velocity( new PointZone( new Point( 50, 0 ) ) ) );
emitter2.addInitializer( new ColorInit( 0xFF0000FF, 0xFFFFFFFF ) );
emitter2.addAction( new Move() );
emitter2.addAction( new GravityWell(15, stage.stageWidth/4, stage.stageHeight/3) );
emitter2.addFilter( new BlurFilter( 2, 2, 1 ) );
addChild( emitter2 );
emitter2.start();

var emitter3:BitmapEmitter = new BitmapEmitter();
emitter3.setCounter( new Blast( 50 ) );
emitter3.addInitializer( new SharedImage( new Dot( 1 ) ) );
var lz3:LineZone = new LineZone( new Point( 3*stage.stageWidth/4, stage.stageHeight/3 ), new Point( 3*stage.stageWidth/4, stage.stageHeight/2) );
emitter3.addInitializer( new Position( lz3 ) );
emitter3.addInitializer( new Velocity( new PointZone( new Point( -50, 0 ) ) ) );
emitter3.addInitializer( new ColorInit( 0xFFFF0000, 0xFFFFFFFF ) );
emitter3.addAction( new Move() );
emitter3.addAction( new GravityWell(15, 3*stage.stageWidth/4, stage.stageHeight/3) );
emitter3.addFilter( new BlurFilter( 2, 2, 1 ) );
addChild( emitter3 );
emitter3.start();
]]>
RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=11#Comment_11 2008-02-26T05:05:31+00:00 2011-12-13T00:39:16+00:00 bandersen http://flintparticles.org/forum/account.php?u=6 Beautiful work. Right-clicking, then holding a bit before releasing on the GravityWells examples, I notice that the trails disappear and the number of particles decreases. Why is that? Right-clicking, then holding a bit before releasing on the GravityWells examples, I notice that the trails disappear and the number of particles decreases. Why is that?]]> RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=18#Comment_18 2008-02-29T19:15:06+00:00 2008-02-29T19:15:41+00:00 Richard http://flintparticles.org/forum/account.php?u=1 I'm not aware of this and can't reproduce it. What platform, browser and flash player version are you using? RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=23#Comment_23 2008-03-02T22:34:53+00:00 2011-12-13T00:39:16+00:00 bandersen http://flintparticles.org/forum/account.php?u=6 Interesting. I see that the effect does not occur when I right-click and hold for a few seconds on your posted example, but on my blog, the same SWF shows the effect in both Firefox and Safari ...
You can see the effect by visiting <http://ripple.ca> and looking at the Feb. 24th entry titled "Pretty Math".]]>
RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=24#Comment_24 2008-03-03T14:21:52+00:00 2011-12-13T00:39:16+00:00 Richard http://flintparticles.org/forum/account.php?u=1 This seems to be a mac only issue. I use a PC so it didn't occur for me but I just checked it on a friend's mac. On the mac, flash doesn't seem to send an enterFrame event while the right mouse ... RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=25#Comment_25 2008-03-03T16:08:27+00:00 2011-12-13T00:39:16+00:00 bandersen http://flintparticles.org/forum/account.php?u=6 Thanks, Richard! That seems a likely explanation. Much appreciated. And thanks in general for your excellent work here. I am learning a lot from it. RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=26#Comment_26 2008-03-03T16:37:53+00:00 2011-12-13T00:39:16+00:00 bandersen http://flintparticles.org/forum/account.php?u=6 One further thought, Richard. If the above mentioned effect were a Mac thing, how come the one displayed on your site doesn't display the same behavior, even though I am viewing it with a Mac ...
No need to answer, if you feel you've wasted enough time on this. :-)]]>
RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=27#Comment_27 2008-03-03T22:23:16+00:00 2011-12-13T00:39:16+00:00 Richard http://flintparticles.org/forum/account.php?u=1 Because it uses newer code, as described in my explanation above. With the newer code, if the movie is interupted for a long period of time it picks up from where it was rather than jumping on ahead. ... RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=28#Comment_28 2008-03-04T21:40:51+00:00 2011-12-13T00:39:16+00:00 bandersen http://flintparticles.org/forum/account.php?u=6 Thanks again, Richard. RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=1333#Comment_1333 2010-09-11T21:43:26+01:00 2011-12-13T00:39:16+00:00 mankica http://flintparticles.org/forum/account.php?u=408 How can I test this code posted in 2008 with new version of Flint particle system? Or where can I find an older version, one from 2008? RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=1334#Comment_1334 2010-09-12T11:21:06+01:00 2010-09-12T11:22:02+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi It won't work quite the same in the current version of Flint. The relationship between emitters and renderers was changed when version 2 was released. If you want an earlier version of ...
It won't work quite the same in the current version of Flint. The relationship between emitters and renderers was changed when version 2 was released.

If you want an earlier version of Flint, all versions are available here.

If you want to create the same effect but with the latest version of Flint, this will do it.

import org.flintparticles.common.counters.Blast;
import org.flintparticles.common.displayObjects.Dot;
import org.flintparticles.common.initializers.ColorInit;
import org.flintparticles.common.initializers.SharedImage;
import org.flintparticles.twoD.actions.Accelerate;
import org.flintparticles.twoD.actions.GravityWell;
import org.flintparticles.twoD.actions.Move;
import org.flintparticles.twoD.emitters.Emitter2D;
import org.flintparticles.twoD.initializers.Position;
import org.flintparticles.twoD.initializers.Velocity;
import org.flintparticles.twoD.renderers.BitmapRenderer;
import org.flintparticles.twoD.zones.LineZone;
import org.flintparticles.twoD.zones.PointZone;

import flash.display.Sprite;
import flash.filters.BlurFilter;
import flash.geom.Point;
import flash.geom.Rectangle;

var renderer : BitmapRenderer = new BitmapRenderer( new Rectangle( 0, 0, 550, 400 ), true );
renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
addChild( renderer );

var emitter : Emitter2D = new Emitter2D( );
emitter.counter = new Blast( 50 );
emitter.addInitializer( new SharedImage( new Dot( 1 ) ) );
var lz : LineZone = new LineZone( new Point( stage.stageWidth / 3, 3 * stage.stageHeight / 4 ), new Point( 2 * stage.stageWidth / 3, 3 * stage.stageHeight / 4 ) );
emitter.addInitializer( new Position( lz ) );
emitter.addInitializer( new Velocity( new PointZone( new Point( 0, 25 ) ) ) );
emitter.addInitializer( new ColorInit( 0xFF00FF00, 0xFFFFFFFF ) );
emitter.addAction( new Move( ) );
emitter.addAction( new Accelerate( 0, 0 ) );
emitter.addAction( new GravityWell( 25, stage.stageWidth / 2, 2 * stage.stageHeight / 3 ) );
renderer.addEmitter( emitter );
emitter.start( );

var emitter2 : Emitter2D = new Emitter2D( );
emitter2.counter = new Blast( 50 );
emitter2.addInitializer( new SharedImage( new Dot( 1 ) ) );
var lz2 : LineZone = new LineZone( new Point( stage.stageWidth / 4, stage.stageHeight / 3 ), new Point( stage.stageWidth / 4, stage.stageHeight / 2 ) );
emitter2.addInitializer( new Position( lz2 ) );
emitter2.addInitializer( new Velocity( new PointZone( new Point( 50, 0 ) ) ) );
emitter2.addInitializer( new ColorInit( 0xFF0000FF, 0xFFFFFFFF ) );
emitter2.addAction( new Move( ) );
emitter2.addAction( new GravityWell( 15, stage.stageWidth / 4, stage.stageHeight / 3 ) );
renderer.addEmitter( emitter2 );
emitter2.start( );

var emitter3 : Emitter2D = new Emitter2D( );
emitter3.counter = new Blast( 50 );
emitter3.addInitializer( new SharedImage( new Dot( 1 ) ) );
var lz3 : LineZone = new LineZone( new Point( 3 * stage.stageWidth / 4, stage.stageHeight / 3 ), new Point( 3 * stage.stageWidth / 4, stage.stageHeight / 2 ) );
emitter3.addInitializer( new Position( lz3 ) );
emitter3.addInitializer( new Velocity( new PointZone( new Point( -50, 0 ) ) ) );
emitter3.addInitializer( new ColorInit( 0xFFFF0000, 0xFFFFFFFF ) );
emitter3.addAction( new Move( ) );
emitter3.addAction( new GravityWell( 15, 3 * stage.stageWidth / 4, stage.stageHeight / 3 ) );
renderer.addEmitter( emitter3 );
emitter3.start( );
]]>
RGB particle fun http://flintparticles.org/forum/comments.php?DiscussionID=3&Focus=1336#Comment_1336 2010-09-12T15:25:17+01:00 2011-12-13T00:39:16+00:00 mankica http://flintparticles.org/forum/account.php?u=408 That's great! Thank you!