
gScale = GUI_Graph(
   {
      0.00,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(
	2.00,
   "Start Scale",
   0.5,2.0);

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

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

gColor = GUI_Graph(
   {
		Color(0.99,0.94,0.94,1.00),446,
		Color(0.99,0.94,0.94,1.00),351,
		Color(1.00,1.00,1.00,0.9)
	},
   Color(0,0,0,0),
   Color(1,1,1,1),
   {
		{0.99,0.94,0.94,1.00,time=0.00},
		{0.99,0.94,0.94,1.00,time=446.39},
		{1.00,1.00,1.00,0.98,time=798.16},
	},
   "Color");

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

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

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

gBlendMode = GUI_Select(
	kBlendAdditiveAlpha,
   "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("images/minigame/match3/heart_texture","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(-0.5,-0.5),Vec2(0.5,-0.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),600,Vec2(0,0.1)));
pPosition:Anim(pPosition+pVelocity);
pColor:Anim(fFade(pAge,toparams(gColor)));
pScale:Anim(pScale+fFade(pAge,toparams(gScale)));

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

function Update(seconds)
   CreateParticles( seconds * gPPS );
end

