-- functions


function stopAllAnimations()
	local oldAnim = currentAnim

	-- return to idle if finishing an emote
	if emoteNames[oldAnim] and emoteNames[oldAnim] == false 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