
mEmitSpeed = GUI_Slider(
	96.20,
      "Emitter Speed",
      0,200);

mScale = GUI_Slider(
   1.00,
      "Initial Scale",
      0,3.0);

mBlendMode = GUI_Select(
   kBlendAdditiveAlpha,
      "Blend Mode",
      {
         { description="Normal", value=kBlendNormal},
         { description="Additive", value=kBlendAdditiveAlpha}
      }
);

-- ------------------------------------------------------------
-- Define our particle characteristics

pAge = Allocate(1) ; -- Allocate a TReal age member
pSpin = Allocate(1); -- Allocate a TReal spin member
pSpinSpeed = Allocate(1); -- Allocate a TReal spin member
pRadius = Allocate(1);

SetTexture( "particles/hint" );
SetBlendMode(mBlendMode);
SetNumParticles( 200 );

-- ------------------------------------------------------------
-- Initialization rules.

dLocus = Vec2(400,300); 
dSize = 200;
dVarSize = 30;
dRed = 1;
dGreen = 1;
dBlue = 1;

pRadius:Init( fRange( dSize - dVarSize, dSize + dVarSize ) );
pScale:Init( mScale );
pAge:Init(0);
pSpin:Init( fRange( 0, 2 * 3.1415927 ) );
pSpinSpeed:Init( fRange( -3, 3 ) );

-- ------------------------------------------------------------
-- Particle Parameter Animation Functions

pPosition:Anim( f2dRotation( pSpin ) * pRadius + dLocus );
pScale:Anim( pScale + fTimeScale( 1 ) );
pColor:Anim( 
   fFade( pAge,
         Color( dRed, dGreen, dBlue, 0 ), 200,
         Color( dRed, dGreen, dBlue, 1 ), 300,
         Color( dRed, dGreen, dBlue, 0 ) )
   );

pSpin:Anim( pSpin + fTimeScale( pSpinSpeed ) );
pUp:Anim( f2dRotation( pSpin ) );
pAge:Anim( pAge + fAge() );

-- General Anim functions
Anim( fExpire( fGreater( pAge, 500 ) ) );

-- ------------------------------------------------------------

gActive = 0;

function Update(seconds)
   if gActive > 0 then
      CreateParticles( seconds * mEmitSpeed );
   end
end
