pAge = Allocate(1) ; -- Allocate a parameter representing age.
pVelocity = Allocate(2)
-- Set the particle texture
SetTexture("blind.png");
SetBlendMode(kBlendNormal);

SetNumParticles(100);    -- Create some particles
pVelocity:Init( f2dRadius( 40) * fRange( 0.6,0.6));
if not dPos then
  dPos = Vec2( 1, 1)
end
pPosition:Init(  dPos);
pColor:Init( Color(1,1,1,1) );
pScale:Init( fRange( 1, 1 ) );
--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(1,1,1,0) ) );
pPosition:Anim( pPosition + fTimeScale( pVelocity) );
-- 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
gActive = true;
function Update(seconds)
   -- Create 20 particle per second
   if gActive then
      CreateParticles( seconds * 100 );
   end
end

