
require "CTraceEffectMovie"

function DoTraceEffect( i_oMovieObj, i_oBaseMovie, i_sTraceMovieName )
	
	local oMovie = CTraceEffectMovie:Create( i_oMovieObj, "TraceHighlight", i_sTraceMovieName, 1.0, nil, false )
	oMovie:SetPosition( i_oBaseMovie:GetX() + 4, i_oBaseMovie:GetY() + 4 )
	--oMovie:SetPosition( 270, 245 )

	oMovie = CTraceEffectMovie:Create( i_oMovieObj, "TraceHighlightAndHold", i_sTraceMovieName, 1.0, nil, true )
	--local oBaseImage = oMovie:CreateInstance( "minigame_logo_pm.png", "base" )
	i_oBaseMovie:MoveToBack()
	oMovie:SetPosition( i_oBaseMovie:GetX() + 4, i_oBaseMovie:GetY() + 4 )
	i_oBaseMovie:SetOpacity( 1.0 )
	oMovie:SetOpacity( 1 )
	
	oMovie:SetDeleteHoldTime( 0.6 )
	
	--oMovie:SetPosition( 270, 245 )
	oMovie.m_fFadeDelay = 0.6
	
	oMovie.OnUpdate2 = oMovie.OnUpdate
	function oMovie:OnUpdate()
		if ( self.m_bReadyForDelete ) then
			if ( self.m_fFadeDelay > 0 ) then
				if ( self.m_fFadeDelay < 0.55 ) then
					oMovie:SetOpacity( math.min( 1, oMovie:GetOpacity() + 0.05 ) )
				end

				self.m_fFadeDelay = self.m_fFadeDelay - 1 / 60
			else
				if ( i_oBaseMovie ~= nil ) then
					i_oBaseMovie:SetOpacity( math.max( 0, i_oBaseMovie:GetOpacity() - 0.03 ) )
				end
			end
		end

		self:OnUpdate2()
	end
end