Add this portion for mouse being on a frame or on a unit
Lua Code:
addon:SetScript("OnUpdate", function(self, elapsed)
local speed = GetUnitSpeed("player");
if speed ~=0 then
UIFrameFadeIn(UIParent, 1, UIParent:GetAlpha(), 1);
else
if GetMouseFocus() then
if GetMouseFocus():GetName() ~= "WorldFrame" then
UIFrameFadeIn(UIParent, 1, UIParent:GetAlpha(), 1);
else
if not UnitAffectingCombat("player") then
UIFrameFadeOut(UIParent, 3, UIParent:GetAlpha(), 0.1);
end;
end;
end;
end;
if UnitName("mouseover") then
UIFrameFadeIn(UIParent, 1, UIParent:GetAlpha(), 1);
end;
end);