Skip to content

Commit

Permalink
feat: #1857 - Add LibCustomGlow animations
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Sep 7, 2024
1 parent 7c66981 commit 2170cf6
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 9 deletions.
1 change: 1 addition & 0 deletions .pkgmeta
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ externals:
Lib/LibDogTag-Stats-3.0: https://github.com/ascott18/LibDogTag-Stats-3.0.git

Lib/LibSpellRange-1.0: https://github.com/ascott18/LibSpellRange-1.0.git
Lib/LibCustomGlow-1.0: https://github.com/Stanzilla/LibCustomGlow.git
Lib/LibOO-1.0: https://github.com/ascott18/LibOO-1.0.git

Lib/LibRangeCheck-3.0: https://github.com/WeakAuras/LibRangeCheck-3.0
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## v11.0.7
* #1857 - Add LibCustomGlow animations.
* Fix: #2215 - Spell Charges condition not updating for countable spells without true charges.
* Fix: #2217 - Error in item cooldown conditions
* Fix: #2220 - GCD state not ending when GCD ends.
Expand Down
141 changes: 138 additions & 3 deletions Components/EventHandlers/Animations/Animations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Animations:RegisterEventDefaults{
SizeY = 30,
Thickness = 2,
Scale = 1,
Speed = 1,
Fade = true,
Infinite = false,
AnimColor = "7fff0000",
Expand Down Expand Up @@ -564,6 +565,138 @@ Animations:RegisterEventHandlerDataNonSpecific(70, "ICONBORDER", {
icon.animation_border:Hide()
end,
})

local LibCustomGlow = LibStub("LibCustomGlow-1.0", true)
if LibCustomGlow then
Animations:RegisterEventHandlerDataNonSpecific(71, "LCG_PIXEL", {
text = L["ANIM_LCG_PIXEL"],
desc = L["ANIM_LCG_PIXEL_DESC"],
ConfigFrames = {
"Duration",
"Infinite",
"Color",
"Size_anim",
"Thickness",
"Speed",
"AnchorTo",
},

Play = function(icon, eventSettings)
local Duration = 0
if eventSettings.Infinite then
Duration = huge
else
Duration = eventSettings.Duration
end

local c = TMW:StringToCachedRGBATable(eventSettings.AnimColor)
icon:Animations_Start{
eventSettings = eventSettings,
Start = TMW.time,
Duration = Duration,

Color = {c.r, c.g, c.b, c.a},
Thickness = eventSettings.Thickness,
Size = eventSettings.Size_anim,
Speed = eventSettings.Speed,
Key = tostring(eventSettings),

AnchorTo = eventSettings.AnchorTo,
}
end,
OnUpdate = function(icon, table)
if table.Duration - (TMW.time - table.Start) < 0 then
icon:Animations_Stop(table)
end
end,
OnStart = function(icon, table)
local target = GetAnchorOrWarn(icon, table.AnchorTo)
if not target.GetFrameLevel then target = icon end

LibCustomGlow.PixelGlow_Start(
target,
table.Color,
8, -- number of lines. Default value is 8;
0.25 * table.Speed, -- frequency, set to negative to inverse direction of rotation. Default value is 0.25;
nil, -- length of lines. Default value depends on region size and number of lines;
table.Thickness, -- thickness of lines. Default value is 2;
table.Size, table.Size, -- xOffset,yOffset - offset of glow relative to region border;
false, -- border - set to true to create border under lines;
table.Key -- key of glow, allows for multiple glows on one frame;
)
end,
OnStop = function(icon, table)
local target = GetAnchorOrWarn(icon, table.AnchorTo)
if not target.GetFrameLevel then target = icon end

LibCustomGlow.PixelGlow_Stop(target, table.Key)
end,
})

Animations:RegisterEventHandlerDataNonSpecific(72, "LCG_AUTOCAST", {
text = L["ANIM_LCG_AUTOCAST"],
desc = L["ANIM_LCG_AUTOCAST_DESC"],
ConfigFrames = {
"Duration",
"Infinite",
"Color",
"Size_anim",
"Thickness",
"Speed",
"AnchorTo",
},

Play = function(icon, eventSettings)
local Duration = 0
if eventSettings.Infinite then
Duration = huge
else
Duration = eventSettings.Duration
end

local c = TMW:StringToCachedRGBATable(eventSettings.AnimColor)
icon:Animations_Start{
eventSettings = eventSettings,
Start = TMW.time,
Duration = Duration,

Color = {c.r, c.g, c.b, c.a},
Thickness = eventSettings.Thickness,
Size = eventSettings.Size_anim,
Speed = eventSettings.Speed,
Key = tostring(eventSettings),

AnchorTo = eventSettings.AnchorTo,
}
end,
OnUpdate = function(icon, table)
if table.Duration - (TMW.time - table.Start) < 0 then
icon:Animations_Stop(table)
end
end,
OnStart = function(icon, table)
local target = GetAnchorOrWarn(icon, table.AnchorTo)
if not target.GetFrameLevel then target = icon end

LibCustomGlow.AutoCastGlow_Start(
target,
table.Color,
4, -- number of particle groups. Each group contains 4 particles. Default value is 4;
0.25 * table.Speed, -- frequency, set to negative to inverse direction of rotation. Default value is 0.125;
table.Thickness, -- scale - scale of particles;
table.Size, table.Size, -- xOffset,yOffset - offset of glow relative to region border;
table.Key -- key of glow, allows for multiple glows on one frame;
)
end,
OnStop = function(icon, table)
local target = GetAnchorOrWarn(icon, table.AnchorTo)
if not target.GetFrameLevel then target = icon end

LibCustomGlow.AutoCastGlow_Stop(target, table.Key)
end,
})
end

Animations:RegisterEventHandlerDataNonSpecific(80, "ICONOVERLAYIMG", {
text = L["ANIM_ICONOVERLAYIMG"],
desc = L["ANIM_ICONOVERLAYIMG_DESC"],
Expand Down Expand Up @@ -769,11 +902,13 @@ TMW:RegisterCallback("TMW_ICON_ANIMATION_START", function(_, self, table)
if TMW.Locked then
-- Modify the table to play infinitely
table.Duration = math.huge
elseif table.Duration then
table.Duration = 5
TMW:Print("Restricted animation duration to 5 seconds for testing")
end
end

if table.Duration == huge then
table.Duration = 5
TMW:Print("Restricted animation duration to 5 seconds for testing")
end
end)


Expand Down
1 change: 1 addition & 0 deletions Components/EventHandlers/Animations/Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ end
TMW.IE:RegisterRapidSetting("Duration")
TMW.IE:RegisterRapidSetting("Magnitude")
TMW.IE:RegisterRapidSetting("Period")
TMW.IE:RegisterRapidSetting("Speed")
TMW.IE:RegisterRapidSetting("Thickness")
TMW.IE:RegisterRapidSetting("Size_anim")
TMW.IE:RegisterRapidSetting("Scale")
Expand Down
19 changes: 19 additions & 0 deletions Components/EventHandlers/Animations/Config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,25 @@
</Scripts>
</Slider>

<Slider parentKey="Speed" name="$parentSpeed" inherits="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" >
<Scripts>
<OnLoad>
TMW:CInit(self)

self:SetTexts(TMW.L["UIPANEL_SPEED"])
self:SetSetting("Speed")

self:SetMode(self.MODE_ADJUSTING)
self:SetMinMaxValues(0.1, 10)
self:SetValueStep(0.01)
self:SetRange(1)
self:SetTextFormatter(TMW.C.Formatter.PERCENT100, TMW.C.Formatter.PASS)

self:UseLightColor()
</OnLoad>
</Scripts>
</Slider>

<Slider parentKey="SizeX" name="$parentSizeX" inherits="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" >
<Scripts>
<OnLoad>
Expand Down
7 changes: 7 additions & 0 deletions Localization/TellMeWhen-enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,7 @@ L["UIPANEL_RELATIVEPOINT2_DESC"] = "Anchor the group to the %s of the anchor tar
L["ASCENDING"] = "Ascending"
L["DESCENDING"] = "Descending"
L["UIPANEL_SCALE"] = "Scale"
L["UIPANEL_SPEED"] = "Speed"
L["UIPANEL_LEVEL"] = "Frame Level"
L["UIPANEL_LEVEL_DESC"] = "The level within the group's strata that it should be drawn on."
L["UIPANEL_STRATA"] = "Strata"
Expand Down Expand Up @@ -2433,6 +2434,12 @@ L["ANIM_ICONBORDER"] = "Icon: Border"
L["ANIM_ICONBORDER_DESC"] = "Overlays a colored border on the icon."
L["ANIM_ICONOVERLAYIMG"] = "Icon: Image Overlay"
L["ANIM_ICONOVERLAYIMG_DESC"] = "Overlays a custom image over the icon."

L["ANIM_LCG_PIXEL"] = "Icon: Pixel Border"
L["ANIM_LCG_PIXEL_DESC"] = "Overlays the LibCustomGlow animated pixel border."
L["ANIM_LCG_AUTOCAST"] = "Icon: Autocast Border"
L["ANIM_LCG_AUTOCAST_DESC"] = "Overlays an effect similar to the pet autocasting indicator animation."

L["ANIM_ICONCLEAR"] = "Icon: Stop Animations"
L["ANIM_ICONCLEAR_DESC"] = "Stops all animations that are playing on the current icon."

Expand Down
1 change: 1 addition & 0 deletions Options/CHANGELOG.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TMW.CHANGELOG_LASTVER="10.0.0"

TMW.CHANGELOG = [==[
## v11.0.7
* #1857 - Add LibCustomGlow animations.
* Fix: #2215 - Spell Charges condition not updating for countable spells without true charges.
* Fix: #2217 - Error in item cooldown conditions
* Fix: #2220 - GCD state not ending when GCD ends.
Expand Down
4 changes: 2 additions & 2 deletions TellMeWhen-Cata.toc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
## Notes-ruRU: Визуальные, звуковые и текстовые оповещения о готовности заклинаний, способностей, наличии баффов\дебаффов и многого другого.
## Notes-esES: Proporciona notificaciones visuales, auditivas y textuales sobre tiempos de reutilización, ventajas y básicamente cualquier otra cosa.

## OptionalDeps: Masque, Ace3, OmniCC, tullaCC, sct, sctd, MikScrollingBattleText, Parrot, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0, ElvUI, DBM-Core, BigWigs
## OptionalDeps: Masque, Ace3, OmniCC, tullaCC, sct, sctd, MikScrollingBattleText, Parrot, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0, LibCustomGlow-1.0, ElvUI, DBM-Core, BigWigs
# The per character settings are the old settings, but we still need them to upgrade to the new ones. If they aren't defined, then they will be deleted immediately
## SavedVariablesPerCharacter: TellMeWhen_Settings
## SavedVariables: TellMeWhenDB
## X-Embeds: LibStub, Ace3, LibSharedMedia-3.0, LibDataBroker-1.1, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0
## X-Embeds: LibStub, Ace3, LibSharedMedia-3.0, LibDataBroker-1.1, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0, LibCustomGlow-1.0
## X-Category: Combat

includes.xml
Expand Down
4 changes: 2 additions & 2 deletions TellMeWhen-Classic.toc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
## Notes-ruRU: Визуальные, звуковые и текстовые оповещения о готовности заклинаний, способностей, наличии баффов\дебаффов и многого другого.
## Notes-esES: Proporciona notificaciones visuales, auditivas y textuales sobre tiempos de reutilización, ventajas y básicamente cualquier otra cosa.

## OptionalDeps: Masque, Ace3, OmniCC, tullaCC, sct, sctd, MikScrollingBattleText, Parrot, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0, ElvUI, DBM-Core, BigWigs
## OptionalDeps: Masque, Ace3, OmniCC, tullaCC, sct, sctd, MikScrollingBattleText, Parrot, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0, LibCustomGlow-1.0, ElvUI, DBM-Core, BigWigs
# The per character settings are the old settings, but we still need them to upgrade to the new ones. If they aren't defined, then they will be deleted immediately
## SavedVariablesPerCharacter: TellMeWhen_Settings
## SavedVariables: TellMeWhenDB
## X-Embeds: LibStub, Ace3, LibSharedMedia-3.0, LibDataBroker-1.1, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0
## X-Embeds: LibStub, Ace3, LibSharedMedia-3.0, LibDataBroker-1.1, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0, LibCustomGlow-1.0
## X-Category: Combat

includes.xml
Expand Down
4 changes: 2 additions & 2 deletions TellMeWhen.toc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
## Notes-ruRU: Визуальные, звуковые и текстовые оповещения о готовности заклинаний, способностей, наличии баффов\дебаффов и многого другого.
## Notes-esES: Proporciona notificaciones visuales, auditivas y textuales sobre tiempos de reutilización, ventajas y básicamente cualquier otra cosa.

## OptionalDeps: Masque, Ace3, OmniCC, tullaCC, sct, sctd, MikScrollingBattleText, Parrot, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0, ElvUI, DBM-Core, BigWigs
## OptionalDeps: Masque, Ace3, OmniCC, tullaCC, sct, sctd, MikScrollingBattleText, Parrot, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0, LibCustomGlow-1.0, ElvUI, DBM-Core, BigWigs
# The per character settings are the old settings, but we still need them to upgrade to the new ones. If they aren't defined, then they will be deleted immediately
## SavedVariablesPerCharacter: TellMeWhen_Settings
## SavedVariables: TellMeWhenDB
## X-Embeds: LibStub, Ace3, LibSharedMedia-3.0, LibDataBroker-1.1, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0
## X-Embeds: LibStub, Ace3, LibSharedMedia-3.0, LibDataBroker-1.1, DRList-1.0, LibDogTag-3.0, LibDogTag-Unit-3.0, LibDogTag-Stats-3.0, LibSpellRange-1.0, LibOO-1.0, LibRangeCheck-3.0, LibBabble-CreatureType-3.0, LibBabble-Race-3.0, LibCustomGlow-1.0
## X-Category: Combat

includes.xml
Expand Down
1 change: 1 addition & 0 deletions includes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<Include file="Lib\LibDogTag-Unit-3.0\lib.xml" />
<Include file="Lib\LibDogTag-Stats-3.0\lib.xml" />
<Include file="Lib\LibSpellRange-1.0\lib.xml" />
<Include file="Lib\LibCustomGlow-1.0\LibCustomGlow-1.0.xml" />
<Script file="Lib\LibRangeCheck-3.0\LibRangeCheck-3.0\LibRangeCheck-3.0.lua" />
<Include file="Lib\LibBabble-CreatureType-3.0\lib.xml" />
<Include file="Lib\LibBabble-Race-3.0\lib.xml" />
Expand Down

0 comments on commit 2170cf6

Please sign in to comment.