{
	Sword[0] = ColorToAlpha([>>img\sword1.bmp] );	
	Sword[1] = ColorToAlpha([>>img\sword2.bmp] );	
	Sword[2] = ColorToAlpha([>>img\sword3.bmp] );	
	Sword[3] = ColorToAlpha([>>img\sword4.bmp] );	

	BlendIn = 0.5;
	BlendOut = 0.5;
	BlendOutOff = 10;
	TimePerKara = 0.02;

	FUNC["fill_stay"]=
	{
		_col0_r = GetParam( _line, "Color0", CurTime(), 0 );
		_col0_g = GetParam( _line, "Color0", CurTime(), 1 );
		_col0_b = GetParam( _line, "Color0", CurTime(), 2 );
		_draw1 = FillColor( _img_text, _col0_r, _col0_g, _col0_b );
		CurKara( _line, _kara );
		_ce = range(CurLineStart+TimePerKara*_kara+TimePerKara,CurLineStart,CurKaraStart);
		_cs = _ce - TimePerKara*3;
		_a = (CurTime() - _cs)/(_ce-_cs);
		_a = range( _a, 0, 1 );
		DrawFinal( _draw1, _posx, _posy, 100, 100*_a, range(_a*3,0,1) );
	}

	FUNC["fill_split_p1"]=
	{
		if( CompEqual(-1,_binitialized) )
		{
			_binitialized = 1;
			_simg = SwordImg[_line*1000+_kara];
			_myimg = ImgMultiply( _img_text, _simg );
		}
		_col0_r = GetParam( _line, "Color0", CurTime(), 0 );
		_col0_g = GetParam( _line, "Color0", CurTime(), 1 );
		_col0_b = GetParam( _line, "Color0", CurTime(), 2 );
		_draw1 = FillColor( _myimg, _col0_r, _col0_g, _col0_b );
		_p = (CurTime()-_start)/(_end-_start);
		DrawFinal( _draw1, _posx-_p*BlendOutOff, _posy-_p*BlendOutOff, 100, 100, range( 1- _p  ,0,1) );
	}

	FUNC["fill_split_p2"]=
	{
		if( CompEqual(-1,_binitialized) )
		{
			_binitialized = 1;
			_simg = SwordImg[_line*1000+_kara];
			_simg = ImgMulShift( _simg, 1,0, 1,0, 1,0, -1,1 );
			_myimg = ImgMultiply( _img_text, _simg );
		}
		_col0_r = GetParam( _line, "Color0", CurTime(), 0 );
		_col0_g = GetParam( _line, "Color0", CurTime(), 1 );
		_col0_b = GetParam( _line, "Color0", CurTime(), 2 );
		_draw1 = FillColor( _myimg, _col0_r, _col0_g, _col0_b );
		_p = (CurTime()-_start)/(_end-_start);
		DrawFinal( _draw1, _posx+_p*BlendOutOff, _posy+_p*BlendOutOff, 100, 100, range( 1- _p  ,0,1) );
	}

	FUNC["fill_split"]=
	{
		CurKara( _line, _kara );

		_simg = Sword[rand(0,3)];
		_simg = ImgRescale( _simg, GetImgSizeX(_img_text), GetImgSizeY(_img_text) );
		SwordImg[CurLine*1000+CurKara] = _simg;

		Emit( "fill_split_p1", CurKaraStart, CurKaraEnd, CurLine, CurKara, -1 );
		Emit( "fill_split_p2", CurKaraStart, CurKaraEnd, CurLine, CurKara, -1 );

		_col1_r = GetParam( _line, "Color1", CurTime(), 0 );
		_col1_g = GetParam( _line, "Color1", CurTime(), 1 );
		_col1_b = GetParam( _line, "Color1", CurTime(), 2 );
		_draw1 = FillColor( _simg, _col1_r, _col1_g, _col1_b );

		_draw1_r1 = ImgRotate( _draw1, rand(0,1) );
		_draw1_inv = ImgMulShift( _draw1, 1,0, 1,0, 1,0, -1,1 );
		_draw1_r2 = ImgRotate( _draw1_inv, 0-rand(0,1) );

		_draw1_r2 = ImgRescale( _draw1_r2, GetImgSizeX(_draw1_r1), GetImgSizeY(_draw1_r1) );

		_myimg = ImgMultiply( _draw1_r1, _draw1_r2 );


//border explo
		_col2_r = GetParam( _line, "Color2", CurTime(), 0 );
		_col2_g = GetParam( _line, "Color2", CurTime(), 1 );
		_col2_b = GetParam( _line, "Color2", CurTime(), 2 );
		_draw2 = FillColor( _img_text, _col2_r, _col2_g, _col2_b );
//		_draw2 = ImgMulShift( _draw2, 1,0, 1,0, 1,0, 0.1,0 );

		GenParticleFx( "fill_explo", _draw2, 0, _posx, _posy, 0.05, 0.25, 0 );

//swordline
		GenParticleFx( "fill_explo", _myimg, 0, _posx, _posy, 0.03, 0.5, 0 );

		ParticleForce( "fill_explo", _posx+rand(-10,10), _posy+rand(-20,20), 10, 0.05 );
		ParticleForce( "fill_explo", _posx+rand(-20,10), _posy+rand(-10,20), 10, 0.05 );
		ParticleForce( "fill_explo", _posx+rand(-10,20), _posy+rand(-20,10), 10, 0.05 );
		ParticleForce( "fill_explo", _posx+rand(-20,20), _posy+rand(-20,20), 10, 0.05 );
	}

	FUNC["border_stay"]=
	{
		_col2_r = GetParam( _line, "Color2", CurTime(), 0 );
		_col2_g = GetParam( _line, "Color2", CurTime(), 1 );
		_col2_b = GetParam( _line, "Color2", CurTime(), 2 );
		_draw3 = FillColor( _img_border, _col2_r, _col2_g, _col2_b );
		CurKara( _line, _kara );
		_ce = range(CurLineStart+TimePerKara*(_kara-1)+TimePerKara,CurLineStart,CurKaraStart);
		_cs = _ce - TimePerKara*3;
		_a = (CurTime() - _cs)/(_ce-_cs);
		_a = range( _a, 0, 1 );
		DrawFinal( _draw3, _posx, _posy, 100, 100*_a, range(_a*3,0,1) );
	}


	FUNC["perKara_border"]=
	{
		Emit( "border_stay", CurLineStart, CurKaraStart, CurLine, CurKara, -1 );
	}

	FUNC["perKara_fill"]=
	{
		Emit( "fill_stay", CurLineStart, CurKaraStart, CurLine, CurKara, -1 );
		Emit( "fill_split", CurKaraStart, CurKaraStart+oneframe, CurLine, CurKara, -1 );
	}

	FUNC["perLine"]=
	{
		EnumKaras( "perKara_border", CurLine );
		EnumKaras( "perKara_fill", CurLine );
	}

	EnumLines( "perLine" );
}