
gScale = GUI_Graph(
   {
      0.01,366,
      0.02,581,
      0.03
   },
   0.00,
   0.1,
   {
      {0.00,time=0.00},
      {0.02,time=365.61},
      {0.03,time=946.69}
   },
   "Scale Anim");

gStartScale = GUI_Slider(
   1.5,
   "Start Scale",
   0.5,2.0);

gStartPos = GUI_Slider(
   3.40,
   "Start Range",
   0,200);

gRotation = GUI_Slider(
   3.14,
   "Initial Rotation",
   0,6.28);

gColor = GUI_Graph(
   {
      Color(0.99,0.94,0.94,1.0),100,
      Color(0.99,0.94,0.94,0.9),250,
      Color(1.00,1.00,1.00,0.0)
   },
   Color(0,0,0,0),
   Color(1,1,1,1),
   {
      {0.99,0.94,0.94,1.0,time=0.00},
      {0.99,0.94,0.94,0.9,time=250.00},
      {1.00,1.00,1.00,0.00,time=300.00},
   },
   "Color");

gPLife = GUI_Slider(
   600.00,
   "Max Life",
   0,10000);

gPPS = GUI_Slider(
   200.00,
   "Particles Per Second",
   0,200);

gNumParticles = GUI_Slider(
   10.00,
   "Max Particles",
   0,1000);

gBlendMode = GUI_Select(
   kBlendNormal,
   "Blend Mode",
   {
      { description="Normal", value=kBlendNormal},
      { description="Additive Alpha", value=kBlendAdditiveAlpha},
      { description="Multiplicative", value=kBlendMultiplicative},
      { description="Subtractive", value=kBlendSubtractive},
      { description="Opaque", value=kBlendOpaque},

   }
);

gTexture = GUI_PickTexture("fx/teardrop","Texture");

pAge = Allocate(1); 
pVelocity = Allocate(2);
pRotation = Allocate(1);


SetTexture(gTexture);
SetBlendMode(gBlendMode);
SetNumParticles(gNumParticles);

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

pPosition:Init( dLocus+fRange(Vec2(-gStartPos,0),Vec2(gStartPos,0)) );
pScale:Init( fRange(0.3,0.35) );
pColor:Init(Color(1,1,1,1));
pAge:Init(0);
pVelocity:Init(fRange(Vec2(-3.5,-1),Vec2(3.5,-5)));
pRotation:Init(fRange(0.0,6.28));
pUp:Init(f2dRotation(pRotation));

pAge:Anim( pAge+fAge() );
pVelocity:Anim(pVelocity+fFade(pAge,Vec2(0,-0.06),350,Vec2(0,0.5)));
pPosition:Anim(pPosition+pVelocity);
pColor:Anim(fFade(pAge,toparams(gColor)));
pScale:Anim(pScale+fFade(pAge,toparams(gScale)));

Anim( fExpire( fGreater(pAge,gPLife) ) );

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

