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

    • CommentAuthorokp
    • CommentTimeJan 30th 2012
     
    Hi all,

    a total-beginner question...
    I'd like to reproduce the old windows98 stars screensaver :
    stars are emitted in the center region, and moved / scaled up towards the edges of the screen.

    Seems really simple but i'm kinda lost with all thoses functionalities...

    Thanks for your help !
    • CommentAuthorczyky
    • CommentTimeJan 31st 2012
     
    Here's one hack to get you started on your journey to the stars. Notes: The last number in velocity controls the speed of the stars and instead of a dead zone, I just have the particles live for 4 seconds--enough time to make their trek across the reaches of space (or from z = 1000 to the viewer, whichever comes first). Not the most efficient but, hey, neither is this starry universe of ours.

    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.initializers.*;
    import org.flintparticles.threeD.renderers.*;
    import org.flintparticles.threeD.zones.*;

    [SWF(width='400', height='400', frameRate='30', backgroundColor='#000000')]
    var emitter:Emitter3D = new Emitter3D();
    emitter.counter = new Steady( 150 );

    emitter.addInitializer( new ImageClass( Dot, 1) );
    emitter.addInitializer( new ColorInit( 0xFFFFffff, 0xFFFFffff ) );
    emitter.addInitializer( new Position( new PointZone( new Vector3D( stage.width / 2, stage.height / 2, 1000 )) ) );
    emitter.addInitializer( new Velocity( new DiscZone( new Vector3D( -1, -1, -250 ), new Vector3D( 1, 1, -250 ), 30 ) ) );
    emitter.addInitializer( new Lifetime( 4, 4 ) );

    emitter.addAction( new Age() );
    emitter.addAction( new Move() );

    var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( 0, 0, 400, 400 ) );
    renderer.addEmitter( emitter );
    addChild( renderer );
    emitter.start();