pAge = Allocate(1) ; -- Allocate a parameter representing age.

-- Set the particle texture
SetTexture("star.xml");
SetBlendMode(kBlendAdditiveAlpha);

SetNumParticles(40);    -- Create some particles

pPosition:Init( f2dRadius( 60 )  * fRange( 0, 1 ) );
pColor:Init( Color(1,1,1,1) );
pScale:Init( fRange( 0.7, 1.2 ) );
pUp:Init( f2dRadius( 1 ) );   -- random radius
pAge:Init( 0 ) ;

-- Fade the particles.

pAge:Anim( pAge+fAge() );
pColor:Anim( fFade( pAge, Color(1,1,1,1), 1000, Color(0,0,0,0) ) );

-- Expire particles which faded out completelly.

Anim(  fExpire(  fLess( pColor[ 3 ], 0.001 )  )  ) ;

-- A function to run as we're executing
-- seconds - how many seconds have elapsed
function Update(seconds)
   -- Create 10 particle per second
   CreateParticles( seconds * 10 );
end

