View Single Post
02/08/23, 10:07 AM   #4
Anumaril
 
Anumaril's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2018
Posts: 14
Hmm, I'll have to test this out some more. At the moment I'm getting an error where no other window is allowed to be opened, so I can't access the notification window to even see what's wrong

This is what I've got so far:

Code:
local blurFragment = ZO_HUDFadeSceneFragment:New("BlurUI")

HUD_SCENE:AddFragment(blurFragment)
HUD_UI_SCENE:AddFragment(blurFragment)

local function OnBlurFragmentStateChange(oldState, newState)
	if newState == SCENE_FRAGMENT_SHOWN then
 		if staminaPercent <= 0.9 then -- at 90% stamina, begin to blur the screen
 			BlurUI:SetAlpha((1.0 / 0.9) * (0.9 - staminaPercent))
 		else
 			BlurUI:SetAlpha(0.0)
 		end
 	elseif newState == SCENE_FRAGMENT_HIDDEN then
 		BlurUI:SetAlpha(0.0)
 	end
end
The basic idea being to create a TopLevelControl in XML, attach the blur fragment to it, then determine the control's alpha using the player's stamina (staminaPercent is defined elsewhere in the code).
  Reply With Quote