We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › render flame launches with traer
Page Index Toggle Pages: 1
render flame launches with traer (Read 345 times)
render flame launches with traer
Sep 25th, 2008, 3:36pm
 
Hi
I would like render a interractive flame launches with traer.
I began from smoke sketch
I would like get a realistic flame :what is better ,gif,movies...?
thanks
the code:
ParticleSystem physics;
Particle last;

void setup()
{
 size( 400, 400 );
 fill( 255, 64 );
 frameRate( 40 );
 physics = new ParticleSystem( -0.1, 0.001 );
 ellipseMode( CENTER );
 smooth();
 cursor( CROSS );
}

void draw()
{
 for ( int i = 0; i < 5; i++ )
 {
   Particle p = physics.makeParticle( 1000f, mouseX, mouseY, 0 );
   p.setVelocity( random( -2, 2 ), random( -23, -25 ), 0 );
   if ( last != null )
     physics.makeSpring( p, last, 100f, 0.1f, 10 );
   last = p;
 }
 physics.tick();
 background( 255 );

 noStroke();
 for ( int i = 0; i < physics.numberOfParticles(); ++i )
 {
   Particle p = physics.getParticle( i );
 
   
    fill( 255,255,25,300/(p.age()+1) );
   ellipse( p.position().x(), p.position().y(), 90, 80 );

   
   
   if ( p.age() > height )
     p.kill();
 }
}
Page Index Toggle Pages: 1