@@ -33,46 +33,126 @@ local function SetScaleEffect(indicator, frame, status)
33
33
end
34
34
end
35
35
36
+ local function UpdateScale (self , parent , unit )
37
+ local status , state = self :GetCurrentStatus (unit )
38
+ SetScaleEffect ( self , self .GetBlinkFrame (self ,parent ), status )
39
+ self :OnUpdate (parent , unit , status )
40
+ end
41
+
42
+ -- glowing border effect
43
+ local LCG = LibStub (" LibCustomGlow-1.0" )
44
+
45
+ local function InitGlowPixelAnimation (indicator )
46
+ local dbx = indicator .dbx
47
+ local key = indicator .name
48
+ local funcStart = LCG .PixelGlow_Start
49
+ local funcStop = LCG .PixelGlow_Stop
50
+ local color = dbx .glow_color
51
+ local linesCount = dbx .glow_linesCount or 8
52
+ local frequency = dbx .glow_frequency or 0.25
53
+ local thickness = dbx .glow_thickness or 2
54
+ return function ( frame , enabled )
55
+ if enabled ~= frame .__glowEnabled then
56
+ frame .__glowEnabled = enabled
57
+ if enabled then
58
+ funcStart ( frame , color , linesCount , frequency , nil , thickness , 0 , 0 , false , key )
59
+ else
60
+ funcStop ( frame , key )
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+ local function InitGlowAutoCastAnimation (indicator )
67
+ local dbx = indicator .dbx
68
+ local key = indicator .name
69
+ local funcStart = LCG .AutoCastGlow_Start
70
+ local funcStop = LCG .AutoCastGlow_Stop
71
+ local color = dbx .glow_color
72
+ local particlesCount = dbx .glow_particlesCount or 4
73
+ local frequency = dbx .glow_frequency or 0.12
74
+ local particlesScale = dbx .glow_particlesScale or 1
75
+ return function ( frame , enabled )
76
+ if enabled ~= frame .__glowEnabled then
77
+ frame .__glowEnabled = enabled
78
+ if enabled then
79
+ funcStart ( frame , color , particlesCount , frequency , particlesScale , 0 , 0 , key )
80
+ else
81
+ funcStop ( frame , key )
82
+ end
83
+ end
84
+ end
85
+ end
86
+
87
+ local function InitGlowButtonAnimation (indicator )
88
+ local dbx = indicator .dbx
89
+ local key = indicator .name
90
+ local funcStart = LCG .ButtonGlow_Start
91
+ local funcStop = LCG .ButtonGlow_Stop
92
+ local color = dbx .glow_color
93
+ local frequency = dbx .glow_frequency or 0.12
94
+ return function ( frame , enabled )
95
+ if enabled ~= frame .__glowEnabled then
96
+ frame .__glowEnabled = enabled
97
+ if enabled then
98
+ funcStart ( frame , color , frequency )
99
+ else
100
+ funcStop ( frame )
101
+ end
102
+ end
103
+ end
104
+ end
105
+
106
+ local glowEffectsInit = { InitGlowPixelAnimation , InitGlowAutoCastAnimation , InitGlowButtonAnimation }
107
+
108
+ local function UpdateGlow (self , parent , unit )
109
+ local status , state = self :GetCurrentStatus (unit )
110
+ self .glowAnim ( self .GetBlinkFrame (self ,parent ), state == " blink" )
111
+ self :OnUpdate (parent , unit , status )
112
+ end
113
+
114
+ local function UpdateGlowScale (self , parent , unit )
115
+ local status , state = self :GetCurrentStatus (unit )
116
+ local frame = self .GetBlinkFrame (self ,parent )
117
+ self .glowAnim ( frame , state == " blink" )
118
+ SetScaleEffect ( self , frame , status )
119
+ self :OnUpdate (parent , unit , status )
120
+ end
121
+
36
122
-- Blink effect
37
123
local function CreateBlinkAnimation (frame , dbx )
38
124
local anim = frame :CreateAnimationGroup ()
39
125
local alpha = anim :CreateAnimation (" Alpha" )
126
+ anim .settings = alpha
40
127
anim :SetLooping (" REPEAT" )
41
128
alpha :SetOrder (1 )
42
- alpha :SetFromAlpha (1 )
43
- alpha :SetToAlpha (0.1 )
44
- alpha :SetDuration (1 / dbx .blinkFrequency )
129
+ alpha :SetFromAlpha ( 1 )
130
+ alpha :SetToAlpha ( 0.1 )
131
+ alpha :SetDuration ( 1 / ( dbx .blink_frequency or 2 ) )
45
132
frame .blinkAnim = anim
46
133
return anim
47
134
end
48
135
49
136
local function SetBlinkEffect (indicator , frame , enabled )
50
137
local anim = frame .blinkAnim
51
138
if enabled then
52
- (anim or CreateBlinkAnimation (frame ,Grid2Frame . db . shared )):Play ()
139
+ (anim or CreateBlinkAnimation (frame ,indicator . dbx )):Play ()
53
140
elseif anim then
54
141
anim :Stop ()
55
142
end
56
143
end
57
144
58
- -- Indicator Update functions
59
- local function UpdateBlinkScale (self , parent , unit )
60
- local status , state = self :GetCurrentStatus (unit )
61
- local frame = self .GetBlinkFrame (self ,parent )
62
- SetBlinkEffect ( self , frame , state == " blink" )
63
- SetScaleEffect ( self , frame , status )
64
- self :OnUpdate (parent , unit , status )
65
- end
66
-
67
- local function UpdateScale (self , parent , unit )
145
+ local function UpdateBlink (self , parent , unit )
68
146
local status , state = self :GetCurrentStatus (unit )
69
- SetScaleEffect ( self , self .GetBlinkFrame (self ,parent ), status )
147
+ SetBlinkEffect ( self , self .GetBlinkFrame (self ,parent ), state == " blink " )
70
148
self :OnUpdate (parent , unit , status )
71
149
end
72
150
73
- local function UpdateBlink (self , parent , unit )
151
+ local function UpdateBlinkScale (self , parent , unit )
74
152
local status , state = self :GetCurrentStatus (unit )
75
- SetBlinkEffect ( self , self .GetBlinkFrame (self ,parent ), state == " blink" )
153
+ local frame = self .GetBlinkFrame (self ,parent )
154
+ SetBlinkEffect ( self , frame , state == " blink" )
155
+ SetScaleEffect ( self , frame , status )
76
156
self :OnUpdate (parent , unit , status )
77
157
end
78
158
@@ -82,8 +162,15 @@ function indicatorPrototype:UpdateDB()
82
162
self :LoadDB ()
83
163
end
84
164
if self .GetBlinkFrame then
85
- if Grid2Frame .db .shared .blinkType ~= " None" then
86
- self .Update = self .dbx .animEnabled and UpdateBlinkScale or UpdateBlink
165
+ if Grid2Frame .db .shared .blinkType ~= " None" then -- now blinkType controls blink and glow effects
166
+ local typ = self .dbx .highlightType
167
+ if typ then -- border glow effects
168
+ self .glowAnim = glowEffectsInit [ typ ]( self )
169
+ self .Update = self .dbx .animEnabled and UpdateGlowScale or UpdateGlow
170
+ else -- blink effect
171
+ self .glowAnim = nil
172
+ self .Update = self .dbx .animEnabled and UpdateBlinkScale or UpdateBlink
173
+ end
87
174
else
88
175
self .Update = self .dbx .animEnabled and UpdateScale or indicatorPrototype .Update
89
176
end
0 commit comments