mParticleCount = GUI_Slider(
   6.00,
      "Particle Count",
      0,10);

mMinCenterOffset = GUI_Slider(
   20.00,
      "Min Center Offset",
      0,100);

mMaxCenterOffset = GUI_Slider(
   30.00,
      "Max Center Offset",
      0,100);

mMinFlightRadius = GUI_Slider(
	0.00,
      "Min Flight Radius",
      0,100);

mMaxFlightRadius = GUI_Slider(
	30.00,
      "Max Flight Radius",
      0,100);

mMinFlightSpeed = GUI_Slider(
   0.40,
      "Min Flight Speed (revolutions per second)",
      0,5);

mMaxFlightSpeed = GUI_Slider(
   0.90,
      "Max Flight Speed (revolutions per second)",
      0,5);

mMinScale = GUI_Slider(
   1.80,
      "Min Scale",
      0,5);

mMaxScale = GUI_Slider(
   2.00,
      "Max Scale",
      0,5);

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

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

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

PI = 3.1415926536

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

pCenter = Allocate(2);
pRadius = Allocate(1);
pRotationSpeed = Allocate(1);
pRotationAngle = Allocate(1);

SetTexture(mTextureName);
SetBlendMode(mBlendMode);

SetNumParticles(mParticleCount + 1);

-- ------------------------------------------------------------
-- External params.

if not dLocus then
   dLocus = Vec2(0, 0);
end

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

pCenter:Init(
   f2dRotation(fClosedCycle(0, 2 * PI, mParticleCount + 1) + PI / mParticleCount) *
   fRange(mMinCenterOffset, mMaxCenterOffset));
pRadius:Init(fRange(mMinFlightRadius, mMaxFlightRadius));
pRotationSpeed:Init(fPick(-1, 1) * fRange(mMinFlightSpeed, mMaxFlightSpeed) * 2 * PI);
pRotationAngle:Init(fRange(-PI, PI));

pPosition:Init(dLocus + pCenter + f2dRotation(pRotationAngle) * pRadius);

pScale:Init(fRange(mMinScale, mMaxScale));

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

pRotationAngle:Anim(pRotationAngle + fTimeScale(pRotationSpeed));
pPosition:Anim(dLocus + pCenter + f2dRotation(pRotationAngle) * pRadius);

-- ------------------------------------------------------------
-- Create initial particles (optional)
CreateParticles(mParticleCount);

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

-- A function to run as we're executing
-- seconds - how many seconds have elapsed

function Update(seconds)
end
