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

    • CommentAuthorptaranto
    • CommentTimeNov 17th 2009
     
    I'm trying to adapt the Fireworks example to use it with papervision, but I would like have a little bit more uniform distribution on a sphere or disk zones like in the example below

    http://clockmaker.jp/blog-en/2008/09/pv3d-fireworks/
    demo: http://clockmaker.jp/labs/as3_pv3d_gw_fireworks/main.swf

    Here are my code for the DiskBang:

    public class DiscBang extends Emitter3D
    {
    public function DiscBang( position : Point3D, color : uint )
    {
    counter = new Blast( 50 );

    addInitializer( new ColorInit(color, color) );
    addInitializer( new Position( new PointZone( position ) ) );
    addInitializer( new Velocity( new DiscZone( Point3D.ZERO, Vector3D.AXISZ, 100 ) ) );
    addInitializer( new Lifetime( 3 ) );

    addAction( new Age( Quadratic.easeIn ) );
    addAction( new Move() );
    addAction( new Fade() );
    //addAction( new Accelerate( new Vector3D( 0, -50, 0 ) ) );
    addAction( new LinearDrag( 1 ) );
    }
    }

    and for SphereBang:

    public class SphereBang extends Emitter3D
    {
    public function SphereBang( position : Point3D, color : uint = 0xFFFF0000 )
    {
    counter = new Blast( 50 );

    addInitializer( new ColorInit(color, color) );
    addInitializer( new Position( new PointZone( position ) ) );
    addInitializer( new Velocity( new SphereZone( Point3D.ZERO, 100 ) ) );
    addInitializer( new Lifetime( 3 ) );

    addAction( new Age( Quadratic.easeIn ) );
    addAction( new Move() );
    addAction( new Fade() );
    //addAction( new Accelerate( new Vector3D( 0, -50, 0 ) ) );
    addAction( new LinearDrag( 0.5 ) );
    }
    }

    Here are the results I'm having:
    http://pedrotaranto.com.br/labs/flint/fireworks_disk.swf
    http://pedrotaranto.com.br/labs/flint/fireworks_sphere.swf

    I've tried to use more actions like Explosion and SpeedLimit without success.
    There is any action I'm missing to help me or any parameter I should adjust?

    Thanks in advance for the help.

    Cheers,

    --
    Pedro Taranto
    • CommentAuthorRichard
    • CommentTimeNov 21st 2009
     
    The sphere and disc zones take an inner and outer radius. Try this

    addInitializer( new Velocity( new DiscZone( Point3D.ZERO, Vector3D.AXISZ, 100, 100 ) ) );

    and this

    addInitializer( new Velocity( new SphereZone( Point3D.ZERO, 100, 100 ) ) );
    • CommentAuthorptaranto
    • CommentTimeNov 25th 2009
     
    Thanks, that did the trick