This is a plugin for oUF, which will set the alpha of your oUF frames depending on conditions, the difference between this and oUF_BarFader is oUF_Fader handles custom conditions and a lot more conditions.
How to use.
To use this in your oUF layout you will need a Fader table in your oUF unit object:
You will also need to add oUF_Fader as an optional dep in your layout.
The numbers in red represents the priority of the condition, the lower the number the higher the priority, so Flying will always be priorotised over Resting. If 2 conditions are met and have the same priority then the one with the highest alpha will be chosen
The numbers in blue represents the alpha to be used when the condition is met.
The string in green represent conditions which have to be met for the alpha to be changed.
Also put a NormalAlpha value in your object table so oUF_Fader knows what the alpha of the frame should be when no conditions are met.
self.NormalAlpha = 1
If NormalAlpha is not supplied then the alpha of the frame at creation is used.
Built in Conditions
PlayerHostileTarget: If player can attack target.
UnitHostileTarget: If the unit of the frame can attack it's target.
PlayerTarget: If player has a target.
UnitTarget: If the unit of the frame has a target.
PlayerTaxi: If player is on a taxi (windrider).
UnitTaxi: If the unit of the frame is on a taxi.
PlayerMaxHealth: If player is on maximum health.
UnitMaxHealth: If the unit of the frame is on maximum health.
PlayerMaxMana: If player is on maximum mana.
UnitMaxMana: If the unit of the frame is on maximum mana.
Stealth: If player is stealthed.
Flying: If player is on a flying mount.
Resting: If the player is in a City or Inn.
Combat: If the player is in Combat.
Prefixing a condition with a not outputs the reverse of the condition, i.e. notStealth = .5 would set the alpha to .5 when the player isn't stealthed.
Creating your own Conditions
You can create your own conditions to change alpha.
You can create your own condition by using this function oUF.Fader:RegisterCondition(name, func, event) Arguments
name - the name of the condition to be used to in the object (string)
func - the function to access whether the condition has been met, the function has to arguments arg1 = the unit frame obj, arg2 = the unit (function)
event - any events which will fire when the condition has changed, for multiple events seperate with a ":" (string)