Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

    • CommentAuthorsandersnake
    • CommentTimeSep 13th 2008 edited
     
    First of all I would really like to thank you Richard for creating this particle system!
    It's really awesome.

    I spend some time now with the new v2 version and created a nice imploding / exploding Globe example.
    Check the result over here.

    • CommentAuthorVKT
    • CommentTimeSep 15th 2008
     
    it's seem so good!
    great work~.
    • CommentAuthorRichard
    • CommentTimeSep 15th 2008
     
    Very nice.
    • CommentAuthorsandersnake
    • CommentTimeSep 16th 2008 edited
     
    Thanks!

    Here's the source code (Flex):


    package {
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.MouseEvent;
    import flash.filters.BlurFilter;
    import flash.geom.Rectangle;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.text.TextFormatAlign;

    import org.flintparticles.common.actions.*;
    import org.flintparticles.common.counters.*;
    import org.flintparticles.common.displayObjects.*;
    import org.flintparticles.common.initializers.*;
    import org.flintparticles.threeD.actions.*;
    import org.flintparticles.threeD.emitters.Emitter3D;
    import org.flintparticles.threeD.geom.Vector3D;
    import org.flintparticles.threeD.initializers.*;
    import org.flintparticles.threeD.renderers.*;
    import org.flintparticles.threeD.renderers.controllers.*;
    import org.flintparticles.threeD.zones.*;

    public class Globe extends Sprite {
    private var w:Number = 400;
    private var h:Number = 400;
    private var text:TextField;

    public function Globe(){
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;

    text = new TextField();
    var format:TextFormat = new TextFormat("Verdana", 36, 0xffffff,null,null,null,null,null,"center");
    text.defaultTextFormat = format;
    text.x = 0;
    text.y = h/2 - 18;
    text.width = w;
    text.selectable = false;
    text.text = "Click";
    addChild(text);

    stage.addEventListener(MouseEvent.CLICK, init);
    }

    private function init(e:MouseEvent):void {
    stage.removeEventListener(MouseEvent.CLICK, init);
    removeChild(text);

    var emitter:Emitter3D = new Emitter3D();
    emitter.counter = new Blast( 500 );

    emitter.addInitializer( new ImageClass( Dot, 1 ) );
    emitter.addInitializer( new Position( new SphereZone ( new Vector3D(0, 0, 0), w/2, w/2) ) );
    emitter.addInitializer( new ColorInit( 0xffffffff, 0xffffffbe) );
    emitter.addAction( new Move() );
    emitter.addAction( new GravityWell(50, new Vector3D(0, 0, 0) ) );

    var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( -w/2, -h/2, w, h ), false );
    renderer.camera.dolly( -300 );
    renderer.camera.lift( 100 );
    renderer.camera.target = new Vector3D( 0, 0, 0 );
    renderer.addFilter( new BlurFilter( 8, 8, 4 ) );
    renderer.addEmitter( emitter );
    renderer.x = w/2;
    renderer.y = h/2;
    addChild( renderer );

    emitter.position = new Vector3D( 0, 0, 0, 1 );
    emitter.start( );

    var orbitter:OrbitCamera = new OrbitCamera( stage, renderer.camera );
    orbitter.start();
    }
    }
    }