-- functions


function StopAllAnimations()
	local OldAnim = CurrentAnim

	-- return to idle if finishing an emote
	if EmoteNames[OldAnim] and not EmoteNames[OldAnim] then
		OldAnim = "Idle"
	end

	CurrentAnim = ""
	
	if CurrentAnimKeyframeHandler then
		CurrentAnimKeyframeHandler:disconnect()
	end

	if CurrentAnimTrack then
		CurrentAnimTrack:Stop()
		CurrentAnimTrack:Destroy()
		CurrentAnimTrack = nil
	end
	return OldAnim
end

function SetAnimationSpeed(Speed)
	if Speed ~= CurrentAnimSpeed then
		CurrentAnimSpeed = Speed
		CurrentAnimTrack:AdjustSpeed(CurrentAnimSpeed)
	end
end

function KeyframeReachedFunc(FrameName)
	if FrameName == "End" then