mFadeStart = GUI_Slider(
   0.7,
   "Fade Start Percent",
   0.1,1.0);

mLifetime = GUI_Slider(
   849.04,
      "Particle Lifetime",
      0.1,1500);

mEmitSpeed = GUI_Slider(
   7.32,
      "Emitter Speed",
      0,20);

mRadius = GUI_Slider(
	11.70,
      "Radius",
      0,100);

mMinSpeed = GUI_Slider(
   34.50,
      "Min Speed",
      0,100);

mMaxSpeed = GUI_Slider(
   77.50,
      "Max Speed",
      0,100);

mTextureName = GUI_PickTexture("fx/white_dot","Particle Texture");

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

-- ------------------------------------------------------------
-- Globals

gActive = true;
gStop = 0;

-- ------------------------------------------------------------
-- Define our particle characteristics
pAge = Allocate(1);
pVelocity = Allocate(2);
SetTexture(mTextureName);
SetBlendMode(mBlendMode);
SetNumParticles(mEmitSpeed * mLifetime + 1);

-- ------------------------------------------------------------
-- Initialization rules.
if not dLocus then
   dLocus= Vec2(0,0) ; 
end
pPosition:Init(Vec2(fRange(-mRadius,mRadius), fRange(0,0)) + dLocus);
pVelocity:Init(Vec2(0, fRange(-mMaxSpeed,-mMinSpeed)));
pAge:Init(0);
pScale:Init(1.0);
pColor:Init( Color(1,1,1,1) );

-- ------------------------------------------------------------
-- Particle Parameter Animation Functions
pPosition:Anim( pPosition + fTimeScale(pVelocity));
pAge:Anim( pAge+fAge() );
pScale:Anim( fFade(pAge, 1.0, mLifetime, 0.3) );
pColor:Anim( 
   fFade( 
      pAge, Color(1,1,1,1.0), 
      mLifetime*mFadeStart, Color(0,0,0,1.0),
      mLifetime, Color(0,0,0,0.3)
) );
Anim( fExpire( fGreater(pAge,mLifetime) ) );

-- ------------------------------------------------------------
function Update(seconds)
   if gActive == true then
     CreateParticles(seconds * mEmitSpeed);
   end -- gActive
end

