I've got a problem with my addon - I have some frames with button and "CooldownFrameTemplate" over them and everything goes fine until I do animation of whole button to make it "pulse" (i.e. changing size).
How I create button & cooldown:
local button = CreateFrame( "BUTTON", name, self.frame )
button.name = name
button:SetWidth( 32 )
button:SetHeight( 32 )
-- CD goes first
button.cooldown = CreateFrame("Cooldown", nil, self.frame, "CooldownFrameTemplate")
button.cooldown:SetAllPoints( button )
When pulsing, I change the frame (main frame where button and cooldown of it lives) scale like this:
-- setup scale
w.frame:SetScale( s + ds )
-- now, shift little back
local es, dx = w.frame:GetEffectiveScale(), (w.frame:GetHeight() / 4) * ds
w.frame:SetPoint( "TOPLEFT", UIParent, "BOTTOMLEFT", (info.pos.x / es) - dx, (info.pos.y / es) + dx )
It seem that because of this, the cooldown animation is not visible at this time... If I do any other effect with my frame, like chahing alpha (to make it "fade") - everything looks fine and cooldown animation is visible.
I've tried to change the order how my UI is being created, changing cooldown's parent to be UIParent, changing frames levels and frames stratas, but nothing seem to help :(
ps. Addon name - RangeX, widgets/SpelBase.lua - where the stuff is being created, Pulse.lua - where the effects applied to frame.
I'm curious as to why you're using SetPoint to achieve a "pulse" effect? It seems like it would be more efficient to just anchor the button by its center (or bottom, or whatever) and then use SetScale alone to "pulse" it...
As to your actual question, I have no idea. Does the same thing happen if you only use SetScale? Does the same thing happen if you run the same "pulse" stuff on another button with a cooldown model?
The cooldown frame is a bit of a special case which doesnt behave well to constant moving. If you only scale instead of positioning, do you see the cooldown? (even when the button flys around the screen)
If you do, you should really figure out how to adjust the frame anchoring so you can only scale.
-- Like, use another frame that you anchor to the position on your UIParent, and anchor your button center on the center of that frame. A position offset of 0 doesn't change with scale :)
If I don't fix positioning - I'm still have no cooldown on scaling frame :(
The interesting thing is, it does not matter, what scale % was on the start of CD animation. I mean, if I change (and I have the options for it in my addon) the initial frame scale to 1.5, the cooldown is still fine, until I change scale in OnUpdate again.
One more thing that came to my mind was to change scale first, then re-apply cooldown values immediately. Unfortunately, this fixed nothing :(
Ok, here are my last findings about cooldown frame: it's really magic... I have no explanation, but what helps me to make (most of the time) to show CD frame is ... hiding it!
My widget updates sets the CD values, then checks if it was scaled in same update cycle and if it was, I call the "cooldown:Hide()". I was made it to be sure that I have no CD on scale, because sometimes it becomes visible 50% of time and made a "flashing" over the texture.
What a surprise... Doing ":Hide()" at this moment, did not actually hide the cooldown, but rather help to show it correctly.
So far, I'm testing one of my lowly characters and it works fine.